15357fd3c0
yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarbacreate and moove into new directories for BegushiyBashkir and yalarba
33 lines
721 B
Docker
33 lines
721 B
Docker
# Билд стадия
|
|
FROM golang:1.25.1-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Копируем зависимости
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Копируем исходный код
|
|
COPY . .
|
|
|
|
# Собираем приложение
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd/api
|
|
|
|
# Финальная стадия
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
# Копируем бинарник из builder стадии
|
|
COPY --from=builder /app/main .
|
|
|
|
# Копируем миграции
|
|
COPY --from=builder /app/migrations ./migrations
|
|
|
|
# Экспозим порт
|
|
EXPOSE 8080
|
|
|
|
# Запускаем приложение
|
|
CMD ["./main"] |