Files
media-service/Dockerfile
2026-05-08 17:57:29 +03:00

32 lines
703 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 1. Этап сборки (Builder)
FROM golang:1.26-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /app
ENV GOPRIVATE=git.lendry.ru/*
# Принимаем токен из docker-compose (который взял его из .env)
ARG GIT_TOKEN
RUN git config --global url."https://lendry:${GIT_TOKEN}@git.lendry.ru/".insteadOf "https://git.lendry.ru/"
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o media-service ./cmd
# 2. Финальный образ (Production)
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata
WORKDIR /app
COPY --from=builder /app/media-service .
EXPOSE 50059
CMD ["./media-service"]