Files
server/Dockerfile
T
AmirGhost11 bdb2fcc68f
Hello World / hello (push) Has been cancelled
Build / test-and-build (scribblers-linux-x64, ubuntu-latest) (push) Has been cancelled
Build / test-and-build (scribblers-macos-x64, macos-latest) (push) Has been cancelled
Build / test-and-build (scribblers-x64.exe, windows-latest) (push) Has been cancelled
fix(devops): Dockerfile & .local.env support added
2026-05-13 10:45:07 +03:30

42 lines
922 B
Docker

FROM docker.io/golang:1.25.5 AS builder
WORKDIR /app
# 1. Cache modules
# RUN go env -w GOPROXY=https://package-mirror.liara.ir/repository/go/
# RUN go env -w GOSUMDB=off
COPY go.mod go.sum ./
RUN go mod download -x
# 2. Copy source code
COPY . .
# 3. Build arguments
ARG VERSION="dev"
# 4. Build the binary
ENV CGO_ENABLED=0
RUN go build -trimpath -ldflags "-w -s -X 'medad.fun/internal/version.Version=${VERSION}'" -tags timetzdata -o /s ./cmd/main.go
# -----------------------------------------
# Stage 2: Runner
# -----------------------------------------
FROM scratch
# 1. Copy the binary (CRITICAL)
COPY --from=builder /s /dist
# 2. Copy public assets (FIXED syntax)
COPY .env /.env
# COPY --from=builder /public /public
# 3. Copy SSL certs (UNCOMMENTED)
# COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# 4. Security
USER 248:248
EXPOSE 3000
# 5. Entry point
ENTRYPOINT ["/dist"]