Skip to content

Commit

Permalink
fix: sync ports between Dockerfiles and comments (#3027)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar authored Mar 10, 2022
1 parent 8adbfb0 commit ebd1694
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile-build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
114 changes: 57 additions & 57 deletions .docker/Dockerfile-hsm
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"]
4 changes: 2 additions & 2 deletions .docker/Dockerfile-sqlite
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/conformance/hydra/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down

0 comments on commit ebd1694

Please sign in to comment.