Skip to content

Commit 9f221c1

Browse files
committed
Build multi arch hydra images with patched vulns
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 75010e0 commit 9f221c1

3 files changed

Lines changed: 50 additions & 2 deletions

File tree

k8s/cloud/base/ory_auth/hydra/hydra_deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ spec:
6363
# yamllint disable-line rule:line-length
6464
value: postgres://$(PL_POSTGRES_USERNAME):$(PL_POSTGRES_PASSWORD)@$(PL_POSTGRES_HOSTNAME):$(PL_POSTGRES_PORT)/$(PL_POSTGRES_DB)?sslmode=disable&max_conns=20&max_idle_conns=4
6565
imagePullPolicy: IfNotPresent
66-
image: docker.io/ddelnano/hydra:v2.3.0-go1.23@sha256:9382a850d54ff48f1f6b3bfa277a2ec430285bcaf500d09ee7ea7a7cca18e246
66+
image: ghcr.io/pixie-io/hydra:2.3.0-scratch@sha256:460d7738ec473cd5d74a725221cc629eb03b76f68593194496700c2d43e05b70
6767
volumeMounts:
6868
- mountPath: /etc/config/hydra
6969
name: config
@@ -79,7 +79,7 @@ spec:
7979
containers:
8080
- name: server
8181
imagePullPolicy: IfNotPresent
82-
image: docker.io/ddelnano/hydra:v2.3.0-go1.23@sha256:9382a850d54ff48f1f6b3bfa277a2ec430285bcaf500d09ee7ea7a7cca18e246
82+
image: ghcr.io/pixie-io/hydra:2.3.0-scratch@sha256:460d7738ec473cd5d74a725221cc629eb03b76f68593194496700c2d43e05b70
8383
args:
8484
- serve
8585
- -c

tools/docker/Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ nats_image_tag := "ghcr.io/pixie-io/nats:$(NATS_IMAGE_VERSION)-scratch"
122122
## Ory image parameters.
123123
KRATOS_IMAGE_VERSION := 1.3.1
124124
kratos_image_tag := "ghcr.io/pixie-io/kratos:$(KRATOS_IMAGE_VERSION)-scratch"
125+
HYDRA_IMAGE_VERSION := 2.3.0
126+
hydra_image_tag := "ghcr.io/pixie-io/hydra:$(HYDRA_IMAGE_VERSION)-scratch"
125127

126128
## Copybara image parameters.
127129
COPYBARA_IMAGE_VERSION := 20210420
@@ -289,6 +291,15 @@ build_and_upload_kratos_image:
289291
-t $(kratos_image_tag) \
290292
--push
291293

294+
.PHONY: build_and_upload_hydra_image
295+
build_and_upload_hydra_image:
296+
$(DOCKER) buildx build hydra_image \
297+
--platform linux/amd64,linux/arm64 \
298+
--build-arg=HYDRA_VERSION="v$(HYDRA_IMAGE_VERSION)" \
299+
--build-arg=BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
300+
-t $(hydra_image_tag) \
301+
--push
302+
292303
.PHONY: build_and_upload_copybara_image
293304
build_and_upload_copybara_image:
294305
$(DOCKER) build copybara -t $(copybara_image_tag)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM --platform=$BUILDPLATFORM golang:1.24-alpine@sha256:9fadeb603e14f1f3e08bdbec6681fa14446053c498a554f3e57260bf892c487e AS build
2+
3+
ARG TARGETOS TARGETARCH
4+
ARG HYDRA_VERSION
5+
6+
ARG GOOS=$TARGETOS
7+
ARG GOARCH=$TARGETARCH
8+
9+
WORKDIR /src
10+
11+
RUN apk update
12+
RUN apk add git
13+
14+
RUN git clone --depth 1 https://github.com/ory/hydra.git
15+
WORKDIR /src/hydra
16+
RUN git fetch --tags && git checkout $HYDRA_VERSION
17+
18+
ENV GO111MODULE=on
19+
# kratos and hydra require CGO if sqlite is used, but we exclusively use postgres
20+
ENV CGO_ENABLED=0
21+
22+
RUN go mod download
23+
24+
# TODO(ddelnano): Remove once hydra upstream has updated dependencies
25+
RUN go get github.com/golang-jwt/jwt/v5@v5.2.2
26+
RUN go get golang.org/x/oauth2@v0.27.0
27+
28+
RUN go build -ldflags="-extldflags=-static" -tags sqlite_omit_load_extension -o /usr/bin/hydra
29+
30+
FROM gcr.io/distroless/static-debian12:nonroot@sha256:627d6c5a23ad24e6bdff827f16c7b60e0289029b0c79e9f7ccd54ae3279fb45f
31+
32+
COPY --from=build /usr/bin/hydra /usr/bin/hydra
33+
34+
EXPOSE 4444 4445
35+
36+
ENTRYPOINT ["hydra"]
37+
CMD ["serve", "all"]

0 commit comments

Comments
 (0)