Skip to content

Commit

Permalink
Refactoring Dockerfile (#118)
Browse files Browse the repository at this point in the history
* Refactored Dockerfile to simplify the base image declaration

* Refactored Dockerfile to reduce number of layers
  • Loading branch information
PatrickBaus authored Jan 21, 2025
1 parent 045032b commit c087582
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM alpine:3.21.2 AS builder
FROM alpine:3.21.2 as base

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (linux/amd64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

Check warning on line 1 in Dockerfile

View workflow job for this annotation

GitHub Actions / build (linux/arm64)

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

FROM base AS builder

ARG TARGETPLATFORM

Expand All @@ -22,7 +24,7 @@ RUN COLOUR='\e[1;93m' && \
pip install -r /app/requirements.txt && \
echo -e "${COLOUR}Done.\e[0m"

FROM alpine:3.21.2
FROM base AS runner
LABEL maintainer="Patrick Baus <[email protected]>"
LABEL description="Kraken sensor data aggregator."

Expand All @@ -41,8 +43,7 @@ COPY --from=builder /opt/venv /opt/venv
# Enable venv
ENV PATH="/opt/venv/bin:$PATH"

COPY --from=builder /app /app
RUN chown -R worker:worker /app
COPY --from=builder --chown=worker:worker /app /app

USER worker

Expand Down

0 comments on commit c087582

Please sign in to comment.