Files
goma-gateway/Dockerfile

33 lines
1.1 KiB
Docker
Raw Normal View History

2024-10-27 06:10:27 +01:00
FROM golang:1.23.2 AS build
WORKDIR /app
ARG appVersion=""
2024-11-11 08:52:52 +01:00
ARG buildTime=""
ARG gitCommit=""
2024-10-27 06:10:27 +01:00
# Copy the source code.
COPY . .
# Installs Go dependencies
RUN go mod download
# Build
2024-11-11 08:52:52 +01:00
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-X 'github.com/jkaninda/goma-gateway/util.Version=${appVersion}' -X 'github.com/jkaninda/goma-gateway/util.buildTime=${buildTime}'-X 'github.com/jkaninda/goma-gateway/util.gitCommit=${gitCommit}'" -o /app/goma
2024-10-27 06:10:27 +01:00
FROM alpine:3.20.3
ENV TZ=UTC
2024-11-07 15:42:11 +01:00
ARG WORKDIR="/etc/goma/"
2024-10-27 06:10:27 +01:00
ARG appVersion=""
ARG user="goma"
LABEL author="Jonas Kaninda"
LABEL version=${appVersion}
2024-10-27 07:36:59 +01:00
LABEL github="github.com/jkaninda/goma-gateway"
2024-10-27 06:10:27 +01:00
2024-11-07 15:42:11 +01:00
RUN mkdir -p ${WORKDIR} && \
chmod a+rw ${WORKDIR}
2024-10-27 06:10:27 +01:00
COPY --from=build /app/goma /usr/local/bin/goma
RUN chmod a+x /usr/local/bin/goma && \
2024-10-27 06:10:27 +01:00
ln -s /usr/local/bin/goma /usr/bin/goma
RUN addgroup -S ${user} && adduser -S ${user} -G ${user}
RUN apk --update add --no-cache tzdata ca-certificates curl #libcap && setcap 'cap_net_bind_service=+ep' /usr/local/bin/goma
2024-10-27 06:10:27 +01:00
USER ${user}
2024-11-07 10:14:49 +01:00
EXPOSE 8080 8443
2024-10-27 06:10:27 +01:00
WORKDIR $WORKDIR
ENTRYPOINT ["/usr/local/bin/goma"]