Files
Messenger/Dockerfile
T
vantablackTea 1a669c948a
CI / Go (build + vet + test) (push) Successful in 10m49s
CI / Web (build + lint) (push) Successful in 10m31s
first commit. added CI, Docker compose, blank client and server. used unit tests, they pass
2026-09-05 01:04:12 +03:00

26 lines
674 B
Docker

# --- Frontend build stage ---
FROM node:22-alpine AS web
WORKDIR /build/web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ .
RUN npm run build
# --- Go build stage ---
FROM golang:1.27-alpine AS api
WORKDIR /build
COPY server/go.mod server/go.sum ./
RUN go mod download
COPY server/ .
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/api ./cmd/api
# --- Runtime stage ---
FROM alpine:3.20 AS runtime
RUN adduser -D -u 10001 app
WORKDIR /app
COPY --from=api --chown=app:app /out/api /app/api
COPY --from=web --chown=app:app /build/web/dist /app/web
USER app
ENV MESSENGER_STATIC_DIR=/app/web
EXPOSE 8080
ENTRYPOINT ["/app/api"]