Files
ITWorx-Pulse-Public/deploy/postgres.Dockerfile
T
ITWorx Pulse release export bd774932d5
Public source validation / validate (push) Failing after 3m8s
Publish ITWorx Pulse source
2026-09-03 02:09:19 +02:00

38 lines
1.3 KiB
Docker

# Keep PostgreSQL on the official image, but rebuild its privilege-drop helper
# with the repository's current Go toolchain so the static helper does not carry
# stale Go standard-library vulnerabilities.
FROM golang:1.26.6-alpine@sha256:3889b425f035be855a72fb4755265311293b6d414521f0a519d819df32222d83 AS gosu-builder
ARG TARGETARCH
WORKDIR /src
RUN apk add --no-cache git \
&& git init \
&& git remote add origin https://github.com/tianon/gosu.git \
&& git fetch --depth=1 origin refs/tags/1.19 \
&& git checkout --detach FETCH_HEAD
RUN go get golang.org/x/sys@v0.44.0
RUN case "${TARGETARCH}" in \
amd64) export GOARCH=amd64 ;; \
arm64) export GOARCH=arm64 ;; \
arm) export GOARCH=arm ;; \
386) export GOARCH=386 ;; \
*) echo "unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o /out/gosu .
FROM postgres:17-alpine@sha256:742f40ea20b9ff2ff31db5458d127452988a2164df9e17441e191f3b72252193
COPY --from=gosu-builder /out/gosu /usr/local/bin/gosu
RUN apk upgrade --no-cache \
&& chmod 0755 /usr/local/bin/gosu \
&& gosu --version \
&& gosu nobody true
USER postgres
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 CMD pg_isready -U $${POSTGRES_USER:-postgres} -d $${POSTGRES_DB:-postgres}