-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile.fly
More file actions
35 lines (26 loc) · 811 Bytes
/
Copy pathDockerfile.fly
File metadata and controls
35 lines (26 loc) · 811 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
# Fly.io Dockerfile for Sub2API
FROM golang:1.26-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git
# Copy go mod files
COPY backend/go.mod backend/go.sum ./
RUN go mod download
# Copy backend source
COPY backend/ ./
# Build frontend first
RUN apk add --no-cache nodejs npm
WORKDIR /app/frontend
RUN npm install -g pnpm && pnpm install && pnpm run build
# Go back to backend and build
WORKDIR /app/backend
COPY --from=frontend-builder /app/frontend/dist ./internal/web/dist
RUN CGO_ENABLED=0 GOOS=linux go build -o sub2api ./cmd/server
# Final stage
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/backend/sub2api .
COPY --from=builder /app/backend/internal/web ./internal/web
COPY deploy/config.example.yaml ./data/config.yaml
EXPOSE 8080
CMD ["./sub2api"]