-
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.
Improves the docker set up and removes some unused files. Closes #3914 Closes #3916 Closes #3685 Closes #3683
- Loading branch information
Showing
16 changed files
with
96 additions
and
188 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
FROM alpine:3.20 | ||
|
||
RUN addgroup -S ory; \ | ||
adduser -S ory -G ory -D -H -s /bin/nologin && \ | ||
apk upgrade --no-cache && \ | ||
RUN <<HEREDOC | ||
apk add --no-cache --upgrade ca-certificates | ||
|
||
COPY hydra /usr/bin/hydra | ||
|
||
# set up nsswitch.conf for Go's "netgo" implementation | ||
# - https://github.com/golang/go/blob/go1.9.1/src/net/conf.go#L194-L275 | ||
RUN echo 'hosts: files dns' > /etc/nsswitch.conf | ||
# Add a user/group for nonroot with a stable UID + GID. Values are from nonroot from distroless | ||
# for interoperability with other containers. | ||
addgroup --system --gid 65532 nonroot | ||
adduser --system --uid 65532 \ | ||
--gecos "nonroot User" \ | ||
--home /home/nonroot \ | ||
--ingroup nonroot \ | ||
--shell /sbin/nologin \ | ||
nonroot | ||
HEREDOC | ||
|
||
# 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 && \ | ||
chown ory:ory /var/lib/sqlite | ||
COPY hydra /usr/bin/hydra | ||
|
||
USER ory | ||
USER nonroot | ||
|
||
ENTRYPOINT ["hydra"] | ||
CMD ["serve", "all"] |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM golang:1.23-alpine3.21 AS builder | ||
|
||
RUN apk add --no-cache build-base git gcc bash | ||
|
||
WORKDIR /go/src/github.com/ory/hydra | ||
RUN mkdir -p ./internal/httpclient | ||
|
||
COPY go.mod go.sum ./ | ||
COPY internal/httpclient/go.* ./internal/httpclient | ||
|
||
ENV CGO_ENABLED 1 | ||
|
||
RUN go mod download | ||
COPY . . | ||
|
||
RUN go build -tags sqlite,hsm -o /usr/bin/hydra | ||
|
||
ENV HSM_ENABLED=true | ||
ENV HSM_LIBRARY=/usr/lib/softhsm/libsofthsm2.so | ||
ENV HSM_TOKEN_LABEL=hydra | ||
ENV HSM_PIN=1234 | ||
|
||
RUN apk add --no-cache softhsm opensc | ||
RUN pkcs11-tool --module "$HSM_LIBRARY" --slot 0 --init-token --so-pin 0000 --init-pin --pin "$HSM_PIN" --label "$HSM_TOKEN_LABEL" | ||
|
||
FROM builder as test-hsm | ||
|
||
RUN go test -p 1 -failfast -short -tags=sqlite,hsm ./... | ||
|
||
FROM builder AS test-refresh-hsm | ||
|
||
RUN UPDATE_SNAPSHOTS=true go test -p 1 -failfast -short -tags=sqlite,hsm,refresh ./... |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This directory contains Dockerfiles for various targets: | ||
|
||
- `Dockerfile-distroless` and `Dockerfile-alpine` are published to Docker Hub | ||
via GoReleaser. | ||
- The other `Dockerfile` variants are intended only for local development and | ||
tests. |
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
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,3 +1,5 @@ | ||
version: 2 | ||
|
||
includes: | ||
- from_url: | ||
url: https://raw.githubusercontent.com/ory/xgoreleaser/master/build.tmpl.yml | ||
|
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
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
Oops, something went wrong.