Skip to content

Commit

Permalink
Merge pull request #15 from sebadob/dockerfile-per-target
Browse files Browse the repository at this point in the history
splite the Dockerfile because of a bug with ARG
  • Loading branch information
sebadob committed Aug 12, 2023
2 parents 58da6cb + 6776e2e commit 25e3918
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /work
# the correct access rights
RUN mkdir data

FROM scratch
FROM alpine:3.18.3

ARG BINARY

Expand Down
6 changes: 4 additions & 2 deletions Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM alpine:3.18.2
FROM alpine:3.18.3
#FROM gcr.io/distroless/cc:debug
#FROM gcr.io/distroless/cc

ARG BINARY

USER 10001:10001

WORKDIR /app

COPY --chown=10001:10001 /out/rauthy .
COPY --chown=10001:10001 /out/"$BINARY" ./rauthy
RUN mkdir data

COPY --chown=10001:10001 tls/ ./tls/
Expand Down
21 changes: 21 additions & 0 deletions Dockerfile.postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM alpine:3.18.3 AS builderBackend

WORKDIR /work

# Just a workaroudn to get an empty dir and be able to copy it over to scratch with
# the correct access rights
RUN mkdir data

FROM alpine:3.18.3

USER 10001:10001

WORKDIR /app

COPY --chown=10001:10001 /out/rauthy ./rauthy
COPY --chown=10001:10001 --from=builderBackend /work/data ./data

COPY --chown=10001:10001 tls/ ./tls/
COPY --chown=10001:10001 rauthy.deploy.cfg ./rauthy.cfg

CMD ["/app/rauthy"]
21 changes: 21 additions & 0 deletions Dockerfile.postgres.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM alpine:3.18.3 AS builderBackend

WORKDIR /work

# Just a workaroudn to get an empty dir and be able to copy it over to scratch with
# the correct access rights
RUN mkdir data

FROM alpine:3.18.3

USER 10001:10001

WORKDIR /app

COPY --chown=10001:10001 /out/rauthy ./rauthy
COPY --chown=10001:10001 --from=builderBackend /work/data ./data

COPY --chown=10001:10001 tls/ ./tls/
COPY --chown=10001:10001 rauthy.deploy.cfg ./rauthy.cfg

CMD ["/app/rauthy"]
22 changes: 22 additions & 0 deletions Dockerfile.sqlite
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM alpine:3.18.3 AS builderBackend

WORKDIR /work

# Just a workaroudn to get an empty dir and be able to copy it over to scratch with
# the correct access rights
RUN mkdir data

FROM scratch
#FROM alpine:3.18.3

USER 10001:10001

WORKDIR /app

COPY --chown=10001:10001 /out/rauthy-lite ./rauthy-lite
COPY --chown=10001:10001 --from=builderBackend /work/data ./data

COPY --chown=10001:10001 tls/ ./tls/
COPY --chown=10001:10001 rauthy.deploy.cfg ./rauthy.cfg

CMD ["/app/rauthy-lite"]
22 changes: 22 additions & 0 deletions Dockerfile.sqlite.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM alpine:3.18.3 AS builderBackend

WORKDIR /work

# Just a workaroudn to get an empty dir and be able to copy it over to scratch with
# the correct access rights
RUN mkdir data

FROM scratch
#FROM alpine:3.18.3

USER 10001:10001

WORKDIR /app

COPY --chown=10001:10001 /out/rauthy-lite ./rauthy-lite
COPY --chown=10001:10001 --from=builderBackend /work/data ./data

COPY --chown=10001:10001 tls/ ./tls/
COPY --chown=10001:10001 rauthy.deploy.cfg ./rauthy.cfg

CMD ["/app/rauthy-lite"]
11 changes: 6 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,19 @@ release:


# publishes the application images
publish: build-sqlite build-postgres
#publish: build-sqlite build-postgres
publish:
#!/usr/bin/env bash
set -euxo pipefail
docker build --no-cache -t sdobedev/rauthy:$TAG --build-arg=rauthy .
docker build --no-cache -t sdobedev/rauthy:$TAG -f Dockerfile.postgres .
docker push sdobedev/rauthy:$TAG
docker build --no-cache -f Dockerfile.debug -t sdobedev/rauthy:$TAG-debug --build-arg=rauthy .
docker build --no-cache -f Dockerfile.debug -t sdobedev/rauthy:$TAG-debug -f Dockerfile.postgres.debug .
docker push sdobedev/rauthy:$TAG-debug

docker build --no-cache -t sdobedev/rauthy:$TAG-lite --build-arg=rauthy-lite .
docker build --no-cache -t sdobedev/rauthy:$TAG-lite -f Dockerfile.sqlite .
docker push sdobedev/rauthy:$TAG-lite
docker build --no-cache -f Dockerfile.debug -t sdobedev/rauthy:$TAG-lite-debug --build-arg=rauthy-lite .
docker build --no-cache -f Dockerfile.debug -t sdobedev/rauthy:$TAG-lite-debug -f Dockerfile.sqlite.debug .
docker push sdobedev/rauthy:$TAG-lite-debug

# the `latest` image will always point to the postgres version, which is used more often
Expand Down

0 comments on commit 25e3918

Please sign in to comment.