gcli2api / Dockerfile_old
smgc's picture
Rename Dockerfile to Dockerfile_old
68d419f verified
raw
history blame contribute delete
870 Bytes
# ---------- Build stage ----------
ARG GO_VERSION=1.24
FROM golang:${GO_VERSION}-bookworm AS builder
WORKDIR /src
RUN apt-get update && apt-get install -y git
# Clone sources from GitHub
RUN git clone https://github.com/boltrunner/gcli2api.git .
COPY server.go ./internal/server/server.go
# Optionally download modules, build
RUN go mod download
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH:-amd64} \
go build -trimpath -ldflags="-s -w" -o /out/gcli2api .
# ---------- Runtime stage ----------
FROM alpine:3.20 AS runtime
WORKDIR /app
USER root
RUN apk --no-cache add ca-certificates
RUN chmod -R 777 /app
COPY --from=builder /out/gcli2api /app/gcli2api
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
RUN adduser -D -H -u 10001 appuser
USER 10001
ENTRYPOINT ["/entrypoint.sh"]
CMD ["server", "-c", "/app/config.json"]