-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
55 lines (39 loc) · 1.34 KB
/
Copy pathDockerfile
File metadata and controls
55 lines (39 loc) · 1.34 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Choose Go version
ARG GOLANG_TAG=1.25.6-alpine
FROM golang:${GOLANG_TAG} AS builder
ARG VERSION=""
ARG COMMIT=""
# Install required tools (including gcc and musl-dev for CGO/SQLite)
# Use --no-scripts to avoid trigger issues with QEMU emulation in multi-arch builds
RUN apk add --no-cache --no-scripts ca-certificates git gcc musl-dev
WORKDIR /app
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build the application with version info (CGO_ENABLED=1 for SQLite)
RUN CGO_ENABLED=1 GOOS=linux go build \
-o blockbusterr \
-ldflags="-s -w -X 'main.Version=${VERSION}' -X 'main.Commit=${COMMIT}'" \
./cmd/app/main.go
# Runtime stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
# Use --no-scripts to avoid trigger issues with QEMU emulation in multi-arch builds
RUN apk --no-cache --no-scripts add ca-certificates tzdata && \
update-ca-certificates
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/blockbusterr .
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
# Copy config example
COPY config/config.example.yaml ./config/config.example.yaml
# Copy web templates and static files
COPY web/ ./web/
# Create data directory
RUN mkdir -p /app/data
# Expose port (hardcoded to 9090)
EXPOSE 9090
# Run the application
CMD ["./blockbusterr"]