Skip to content

Commit 75010e0

Browse files
committed
Build multi arch kratos image with patched vulns
Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 389b393 commit 75010e0

3 files changed

Lines changed: 57 additions & 2 deletions

File tree

k8s/cloud/base/ory_auth/kratos/kratos_deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ spec:
4949
# yamllint disable-line rule:line-length
5050
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
5151
imagePullPolicy: IfNotPresent
52-
image: docker.io/ddelnano/kratos:v1.3.1-go1.23@sha256:66540a7f62864e4555a744ed0db2294331a500ddb634846ec2cde1064ce459da
52+
image: ghcr.io/pixie-io/kratos:1.3.1-scratch@sha256:8855cd72b9a5ffa25cc5588b4dc72b40c1b367c7fbe9fd3b1d1a477e731abfdd
5353
resources: {}
5454
securityContext:
5555
allowPrivilegeEscalation: false
@@ -135,7 +135,7 @@ spec:
135135
- name: SELFSERVICE_FLOWS_ERROR_UI_URL
136136
value: https://$(PL_WORK_DOMAIN)/auth/password/error
137137
imagePullPolicy: IfNotPresent
138-
image: docker.io/ddelnano/kratos:v1.3.1-go1.23@sha256:66540a7f62864e4555a744ed0db2294331a500ddb634846ec2cde1064ce459da
138+
image: ghcr.io/pixie-io/kratos:1.3.1-scratch@sha256:8855cd72b9a5ffa25cc5588b4dc72b40c1b367c7fbe9fd3b1d1a477e731abfdd
139139
ports:
140140
- containerPort: 4433
141141
- containerPort: 4434

tools/docker/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ LINUX_HEADERS_GS_PATH := gs://pixie-dev-public/linux-headers/$(LINUX_HEADERS_REV
119119
NATS_IMAGE_VERSION := 2.9.25
120120
nats_image_tag := "ghcr.io/pixie-io/nats:$(NATS_IMAGE_VERSION)-scratch"
121121

122+
## Ory image parameters.
123+
KRATOS_IMAGE_VERSION := 1.3.1
124+
kratos_image_tag := "ghcr.io/pixie-io/kratos:$(KRATOS_IMAGE_VERSION)-scratch"
125+
122126
## Copybara image parameters.
123127
COPYBARA_IMAGE_VERSION := 20210420
124128
copybara_image_tag := "gcr.io/pixie-oss/pixie-dev-public/copybara:$(COPYBARA_IMAGE_VERSION)"
@@ -276,6 +280,15 @@ build_and_upload_nats_image:
276280
-t $(nats_image_tag) \
277281
--push
278282

283+
.PHONY: build_and_upload_kratos_image
284+
build_and_upload_kratos_image:
285+
$(DOCKER) buildx build kratos_image \
286+
--platform linux/amd64,linux/arm64 \
287+
--build-arg=KRATOS_VERSION="v$(KRATOS_IMAGE_VERSION)" \
288+
--build-arg=BUILD_DATE=$(shell date -u +"%Y-%m-%dT%H:%M:%SZ") \
289+
-t $(kratos_image_tag) \
290+
--push
291+
279292
.PHONY: build_and_upload_copybara_image
280293
build_and_upload_copybara_image:
281294
$(DOCKER) build copybara -t $(copybara_image_tag)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FROM --platform=$BUILDPLATFORM golang:1.24-alpine@sha256:9fadeb603e14f1f3e08bdbec6681fa14446053c498a554f3e57260bf892c487e AS build
2+
3+
ARG TARGETOS TARGETARCH
4+
ARG KRATOS_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/kratos.git
15+
WORKDIR /src/kratos
16+
RUN git fetch --tags && git checkout $KRATOS_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 kratos upstream has updated dependencies
25+
RUN go get github.com/golang-jwt/jwt/v4@v4.5.2
26+
RUN go get github.com/golang-jwt/jwt/v5@v5.2.2
27+
RUN go get golang.org/x/crypto@v0.35.0
28+
RUN go get golang.org/x/oauth2@v0.27.0
29+
30+
ARG BUILD_DATE
31+
32+
RUN go build \
33+
-ldflags="-X 'github.com/ory/kratos/driver/config.Version=${KRATOS_VERSION}' -X 'github.com/ory/kratos/driver/config.Date=${BUILD_DATE}' -X 'github.com/ory/kratos/driver/config.Commit=$(git rev-parse HEAD)'" \
34+
-o /usr/bin/kratos
35+
36+
FROM gcr.io/distroless/static-debian12:nonroot
37+
38+
COPY --from=build /usr/bin/kratos /usr/bin/kratos
39+
EXPOSE 4433 4434
40+
41+
ENTRYPOINT ["kratos"]
42+
CMD ["serve"]

0 commit comments

Comments
 (0)