forked from vijeeshr/quickretro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.Dockerfile
More file actions
32 lines (29 loc) · 1.03 KB
/
build.Dockerfile
File metadata and controls
32 lines (29 loc) · 1.03 KB
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
FROM node:24.11.1-alpine AS frontend-builder
WORKDIR /app
# node_modules directory is excluded with .dockerignore
# Copy package files first for efficient caching
COPY src/frontend/package*.json ./
RUN npm install
# Copy source code and run the build
COPY src/frontend/ .
RUN npm run build
FROM golang:1.25.4-alpine AS backend-builder
WORKDIR /app
# Copy Go module files and download dependencies
COPY src/go.mod src/go.sum ./
RUN go mod download
# Copy application source code and config
COPY src/config.toml .
COPY src/*.go ./
# Copy compiled frontend assets from the previous stage
COPY --from=frontend-builder /app/dist frontend/dist
# CGO_ENABLED=0 ensures a static binary
# -ldflags "-s -w" removes debugging symbols, reducing binary size
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w" -o retroapp .
FROM scratch AS final
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
WORKDIR /app
COPY --from=backend-builder /app/retroapp .
COPY --from=backend-builder /app/config.toml .
EXPOSE 8080
CMD ["./retroapp"]