1
0
mirror of https://github.com/umputun/reproxy.git synced 2025-11-23 22:04:57 +02:00
Files
reproxy/Dockerfile
Umputun d83acffb7b build: update Dockerfile to use Go 1.24 and standardize AS syntax
- Change base image from golang:1.23-alpine to golang:1.24-alpine
- Standardize multi-stage build syntax using uppercase 'AS' keyword
- Successfully tested with Docker build
2025-04-19 12:43:16 -05:00

37 lines
1.1 KiB
Docker

FROM golang:1.24-alpine AS backend
ARG GIT_BRANCH
ARG GITHUB_SHA
ARG CI
ENV CGO_ENABLED=0
ADD . /build
WORKDIR /build
RUN apk add --no-cache --update git tzdata ca-certificates
RUN \
if [ -z "$CI" ] ; then \
echo "runs outside of CI" && version=$(git rev-parse --abbrev-ref HEAD)-$(git log -1 --format=%h)-$(date +%Y%m%dT%H:%M:%S); \
else version=${GIT_BRANCH}-${GITHUB_SHA:0:7}-$(date +%Y%m%dT%H:%M:%S); fi && \
echo "version=$version" && \
cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w"
FROM ghcr.io/umputun/baseimage/app:v1.15.0 AS base
FROM scratch
LABEL org.opencontainers.image.source="https://github.com/umputun/reproxy"
ENV REPROXY_IN_DOCKER=1
COPY --from=backend /build/reproxy /srv/reproxy
COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=base /etc/passwd /etc/passwd
COPY --from=base /etc/group /etc/group
# user is implicitly set to `root`, learn how to use non-root user here: https://reproxy.io/#container-security
WORKDIR /srv
ENTRYPOINT ["/srv/reproxy"]