From ebd16940e270561c13aab60a969a4969391d5d80 Mon Sep 17 00:00:00 2001 From: Mitar Date: Thu, 10 Mar 2022 01:58:53 -0800 Subject: [PATCH] fix: sync ports between Dockerfiles and comments (#3027) --- .docker/Dockerfile-build | 2 +- .docker/Dockerfile-hsm | 114 +++++++++++++++--------------- .docker/Dockerfile-sqlite | 4 +- test/conformance/hydra/Dockerfile | 2 +- 4 files changed, 61 insertions(+), 61 deletions(-) diff --git a/.docker/Dockerfile-build b/.docker/Dockerfile-build index 3a04b737b62..58a93c013a7 100644 --- a/.docker/Dockerfile-build +++ b/.docker/Dockerfile-build @@ -33,7 +33,7 @@ VOLUME /var/lib/sqlite # Exposing the ory home directory VOLUME /home/ory -# Declare the standard ports used by hydra (4433 for public service endpoint, 4434 for admin service endpoint) +# Declare the standard ports used by hydra (4444 for public service endpoint, 4445 for admin service endpoint) EXPOSE 4444 4445 USER ory diff --git a/.docker/Dockerfile-hsm b/.docker/Dockerfile-hsm index 4b46f082cc8..22990662baf 100644 --- a/.docker/Dockerfile-hsm +++ b/.docker/Dockerfile-hsm @@ -1,57 +1,57 @@ -FROM golang:1.16-alpine AS builder - -RUN apk -U --no-cache add build-base git gcc bash - -WORKDIR /go/src/github.com/ory/hydra - -ADD go.mod go.mod -ADD go.sum go.sum - -ENV GO111MODULE on -ENV CGO_ENABLED 1 - -RUN go mod download - -ADD . . - -FROM builder as build-hydra -RUN go build -tags=sqlite,hsm -o /usr/bin/hydra - -FROM builder as test-hsm -ENV HSM_ENABLED=true -ENV HSM_LIBRARY=/usr/lib/softhsm/libsofthsm2.so -ENV HSM_TOKEN_LABEL=hydra -ENV HSM_PIN=1234 - -RUN apk -U --no-cache add softhsm opensc; \ - pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --slot 0 --init-token --so-pin 0000 --init-pin --pin 1234 --label hydra; \ - go test -p 1 -v -failfast -short -tags=sqlite,hsm ./... - -FROM alpine:3.14.2 - -RUN apk -U --no-cache add softhsm opensc; \ - pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --slot 0 --init-token --so-pin 0000 --init-pin --pin 1234 --label hydra - -RUN addgroup -S ory; \ - adduser -S ory -G ory -D -h /home/ory -s /bin/nologin; \ - chown -R ory:ory /home/ory; \ - chown -R ory:ory /var/lib/softhsm/tokens - -COPY --from=build-hydra /usr/bin/hydra /usr/bin/hydra - -# By creating the sqlite folder as the ory user, the mounted volume will be owned by ory:ory, which -# is required for read/write of SQLite. -RUN mkdir -p /var/lib/sqlite -RUN chown ory:ory /var/lib/sqlite -VOLUME /var/lib/sqlite - -# Exposing the ory home directory -VOLUME /home/ory - -# Declare the standard ports used by hydra (4433 for public service endpoint, 4434 for admin service endpoint) -EXPOSE 4444 4445 - -USER ory - -ENTRYPOINT ["hydra"] -CMD ["serve"] +FROM golang:1.16-alpine AS builder + +RUN apk -U --no-cache add build-base git gcc bash + +WORKDIR /go/src/github.com/ory/hydra + +ADD go.mod go.mod +ADD go.sum go.sum + +ENV GO111MODULE on +ENV CGO_ENABLED 1 + +RUN go mod download + +ADD . . + +FROM builder as build-hydra +RUN go build -tags=sqlite,hsm -o /usr/bin/hydra + +FROM builder as test-hsm +ENV HSM_ENABLED=true +ENV HSM_LIBRARY=/usr/lib/softhsm/libsofthsm2.so +ENV HSM_TOKEN_LABEL=hydra +ENV HSM_PIN=1234 + +RUN apk -U --no-cache add softhsm opensc; \ + pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --slot 0 --init-token --so-pin 0000 --init-pin --pin 1234 --label hydra; \ + go test -p 1 -v -failfast -short -tags=sqlite,hsm ./... + +FROM alpine:3.14.2 + +RUN apk -U --no-cache add softhsm opensc; \ + pkcs11-tool --module /usr/lib/softhsm/libsofthsm2.so --slot 0 --init-token --so-pin 0000 --init-pin --pin 1234 --label hydra + +RUN addgroup -S ory; \ + adduser -S ory -G ory -D -h /home/ory -s /bin/nologin; \ + chown -R ory:ory /home/ory; \ + chown -R ory:ory /var/lib/softhsm/tokens + +COPY --from=build-hydra /usr/bin/hydra /usr/bin/hydra + +# By creating the sqlite folder as the ory user, the mounted volume will be owned by ory:ory, which +# is required for read/write of SQLite. +RUN mkdir -p /var/lib/sqlite +RUN chown ory:ory /var/lib/sqlite +VOLUME /var/lib/sqlite + +# Exposing the ory home directory +VOLUME /home/ory + +# Declare the standard ports used by hydra (4444 for public service endpoint, 4445 for admin service endpoint) +EXPOSE 4444 4445 + +USER ory + +ENTRYPOINT ["hydra"] +CMD ["serve"] diff --git a/.docker/Dockerfile-sqlite b/.docker/Dockerfile-sqlite index f31b4e21c53..e8534effa03 100644 --- a/.docker/Dockerfile-sqlite +++ b/.docker/Dockerfile-sqlite @@ -25,8 +25,8 @@ VOLUME /var/lib/sqlite # Exposing the ory home directory VOLUME /home/ory -# Declare the standard ports used by Hydra (4433 for public service endpoint, 4434 for admin service endpoint) -EXPOSE 4433 4434 +# Declare the standard ports used by Hydra (4444 for public service endpoint, 4445 for admin service endpoint) +EXPOSE 4444 4445 USER ory diff --git a/test/conformance/hydra/Dockerfile b/test/conformance/hydra/Dockerfile index 0c2311e4883..d39ff8b33c1 100644 --- a/test/conformance/hydra/Dockerfile +++ b/test/conformance/hydra/Dockerfile @@ -22,7 +22,7 @@ VOLUME /var/lib/sqlite # Exposing the ory home directory VOLUME /home/ory -# Declare the standard ports used by hydra (4433 for public service endpoint, 4434 for admin service endpoint) +# Declare the standard ports used by hydra (4444 for public service endpoint, 4445 for admin service endpoint) EXPOSE 4444 4445 RUN mv test/conformance/ssl/ory-ca.* /etc/ssl/certs/