From f455bd7c6dabb774e5512a985d30956616fcdb81 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sun, 5 Apr 2026 08:21:46 +0300 Subject: [PATCH] feat: add docker --- Dockerfile | 12 ++++++++++++ compose.yml | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Dockerfile create mode 100644 compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5866294 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:1.26-alpine AS builder +WORKDIR /app +COPY go.mod go.sum ./ +COPY vendor/ ./vendor/ +COPY . . +RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -o /app/media-service ./cmd/main.go + +FROM alpine:3.21 AS runner +WORKDIR /app +ENV APP_ENV=production +COPY --from=builder /app/media-service . +CMD ["./media-service"] diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..406f1e9 --- /dev/null +++ b/compose.yml @@ -0,0 +1,20 @@ +name: teacinema +services: + media-service: + image: teacinema/media-service:dev + container_name: teacinema-media-service + build: + context: . + dockerfile: Dockerfile + restart: always + env_file: + - .env.production.local + ports: + - '50059:50059' + - '4200:4200' + networks: + - teacinema + +networks: + teacinema: + external: true