-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: sync ports between Dockerfiles and comments (#3027)
- Loading branch information
Showing
4 changed files
with
61 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters