-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 986 Bytes
/
Copy pathDockerfile
File metadata and controls
39 lines (28 loc) · 986 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
37
38
39
# Multi-stage build for the Go backend
FROM golang:1.25.6-alpine AS builder
# Set working directory
WORKDIR /app
# Copy go mod and sum to download dependencies
COPY backend/go.mod backend/go.sum ./
RUN go mod download
# Copy the rest of the source code into working directory
COPY backend/. ./
# Copy migrations from repo root into the build context so migrations are available at runtime
# Build the binary
RUN CGO_ENABLED=0 GOOS=linux go build -o splitcash ./main.go
# Final image
FROM alpine:latest
# Add ca-certificates for TLS support
RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy binary and static files
COPY --from=builder /app/splitcash .
COPY --from=builder /app/openapi.yaml .
COPY --from=builder /app/swagger-ui.html .
COPY --from=builder /app/migrations ./migrations
# copy example environment variables as a starting point
COPY --from=builder /app/env.example .env
# Expose the port the app listens on
EXPOSE 8080
# Entrypoint
CMD ["./splitcash"]