-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (30 loc) · 925 Bytes
/
Dockerfile
File metadata and controls
36 lines (30 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Stage 1: build frontend (Vue + Vite)
# VERSION is passed at build time for image labels (semver from CI)
ARG VERSION=dev
FROM node:22-alpine AS frontend
WORKDIR /workspace/web
COPY web/package.json ./
RUN npm install
COPY web/ ./
RUN npm run build
# Stage 2: build Go server and pack static
FROM golang:1.25-alpine AS builder
WORKDIR /workspace
RUN apk add --no-cache git
COPY go.* ./
COPY cmd/ ./cmd/
COPY internal/ ./internal/
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY --from=frontend /workspace/web/dist ./static
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 go build -o server ./cmd/server
# Final stage
FROM alpine:3.19
WORKDIR /app
RUN apk --no-cache add ca-certificates
COPY --from=builder /workspace/server .
COPY --from=builder /workspace/static /app/static
EXPOSE 8080
CMD ["./server", "--bind-address=:8080"]