-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
34 lines (23 loc) · 918 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM golang:1.23.4 AS build-image
LABEL authors="bixority"
ARG upx_version=4.2.4
ARG GOPROXY
ARG TARGETARCH=${TARGETARCH:-amd64}
WORKDIR /build
ENV CGO_ENABLED=0
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends xz-utils && \
curl -Ls https://github.com/upx/upx/releases/download/v${upx_version}/upx-${upx_version}-${TARGETARCH}_linux.tar.xz -o - | tar xvJf - -C /tmp && \
cp /tmp/upx-${upx_version}-${TARGETARCH}_linux/upx /usr/local/bin/ && \
chmod +x /usr/local/bin/upx && \
apt-get remove -y xz-utils && \
rm -rf /var/lib/apt/lists/*
COPY ./ /build/
RUN make release
FROM gcr.io/distroless/static-debian12:nonroot
LABEL org.opencontainers.image.description="PostgreSQL maintenance tool"
LABEL authors="bixority"
WORKDIR /
COPY --from=build-image /build/bin/pg_maintenance /build/LICENSE /
USER nonroot:nonroot
CMD ["/pg_maintenance"]