2022-06-28 06:31:57 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Builder Stage
|
|
|
|
# ------------------------------------------------------------------------------
|
2024-03-23 07:03:07 +03:00
|
|
|
FROM golang:1.22-bullseye AS build
|
2022-06-28 06:31:57 +03:00
|
|
|
|
2024-03-27 08:44:58 +03:00
|
|
|
# Set default build argument for CGO_ENABLED
|
|
|
|
ARG CGO_ENABLED=0
|
|
|
|
ENV CGO_ENABLED ${CGO_ENABLED}
|
|
|
|
|
2022-06-28 06:31:57 +03:00
|
|
|
WORKDIR /build
|
|
|
|
|
2023-02-16 01:59:39 +03:00
|
|
|
RUN git config --global --add safe.directory /build
|
2023-04-01 02:55:59 +03:00
|
|
|
COPY go.mod go.sum ./
|
2022-06-28 06:31:57 +03:00
|
|
|
RUN go mod download
|
2023-04-01 02:55:59 +03:00
|
|
|
COPY Makefile main.go ./
|
|
|
|
COPY static/ static/
|
|
|
|
COPY pkg/ pkg/
|
|
|
|
COPY .git/ .
|
2022-06-28 06:31:57 +03:00
|
|
|
RUN make build
|
|
|
|
|
2023-04-01 02:55:59 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Fetch signing key
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
FROM debian:bullseye-slim AS keyring
|
|
|
|
ADD https://www.postgresql.org/media/keys/ACCC4CF8.asc keyring.asc
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -qq --no-install-recommends gpg
|
|
|
|
RUN gpg -o keyring.pgp --dearmor keyring.asc
|
|
|
|
|
2022-06-28 06:31:57 +03:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Release Stage
|
|
|
|
# ------------------------------------------------------------------------------
|
2022-10-25 14:55:28 +03:00
|
|
|
FROM debian:bullseye-slim
|
2014-10-28 11:02:27 +03:00
|
|
|
|
2023-04-01 02:55:59 +03:00
|
|
|
ARG keyring=/usr/share/keyrings/postgresql-archive-keyring.pgp
|
|
|
|
COPY --from=keyring /keyring.pgp $keyring
|
|
|
|
RUN . /etc/os-release && \
|
|
|
|
echo "deb [signed-by=${keyring}] http://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
|
|
|
|
apt-get update && \
|
|
|
|
apt-get install -qq --no-install-recommends ca-certificates openssl netcat curl postgresql-client
|
2022-06-28 06:31:57 +03:00
|
|
|
|
|
|
|
COPY --from=build /build/pgweb /usr/bin/pgweb
|
2014-10-28 11:02:27 +03:00
|
|
|
|
2023-04-29 22:07:29 +03:00
|
|
|
RUN useradd --uid 1000 --no-create-home --shell /bin/false pgweb
|
|
|
|
USER pgweb
|
|
|
|
|
2015-07-15 06:26:32 +03:00
|
|
|
EXPOSE 8081
|
2023-02-27 22:14:05 +03:00
|
|
|
ENTRYPOINT ["/usr/bin/pgweb", "--bind=0.0.0.0", "--listen=8081"]
|