Files
test_deploy/Dockerfile
Alex Shevchuk 0c9c8a20db
All checks were successful
Deploy Production / Deploy to Staging (push) Has been skipped
37
2025-08-19 03:10:41 +03:00

34 lines
862 B
Docker

FROM golang:1.24-alpine AS builder
ARG BUILD_LDFLAGS
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download -x
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="${BUILD_LDFLAGS}" -trimpath -o main ./cmd/main.go
FROM alpine:3.18 AS certs
RUN wget -q "https://storage.yandexcloud.net/cloud-certs/CA.pem" -O /YandexInternalRootCA.crt \
&& chmod 0655 /YandexInternalRootCA.crt
FROM alpine:3.18
WORKDIR /
ARG CONFIG_FILE_PATH
RUN apk add --no-cache ca-certificates tzdata
COPY --from=certs /YandexInternalRootCA.crt /root/.redis/YandexInternalRootCA.crt
COPY --from=certs /YandexInternalRootCA.crt /root/.postgres/YandexInternalRootCA.crt
COPY ${CONFIG_FILE_PATH} /config.yaml
COPY --from=builder /app/main /main
RUN adduser -D -u 10001 appuser && chown appuser /main
USER appuser
ENTRYPOINT ["sudo /main"]
CMD ["--config_path", "/config.yaml"]