Create Dockerfile

This commit is contained in:
P4vlushaaa 2025-01-23 13:13:28 +03:00 committed by GitHub
parent 274a94d6f1
commit 8f9f9ec011
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

18
services/api/Dockerfile Normal file
View file

@ -0,0 +1,18 @@
# Dockerfile для API-сервиса
FROM golang:1.20 as builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/bin/api main.go
# Финальный образ
FROM alpine:3.17
WORKDIR /app
COPY --from=builder /app/bin/api /app/api
COPY config.yaml /app/config.yaml
EXPOSE 8080
ENTRYPOINT ["/app/api"]