-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
43 lines (29 loc) · 866 Bytes
/
Dockerfile
File metadata and controls
43 lines (29 loc) · 866 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
40
41
42
43
# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Install build dependencies including gcc and musl-dev for CGO
RUN apk add --no-cache git gcc musl-dev
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Install templ CLI
RUN go install github.com/a-h/templ/cmd/templ@latest
# Copy source code
COPY . .
# Generate Go files from templ templates
RUN templ generate
# Build the application with CGO enabled for sqlite3
RUN CGO_ENABLED=1 GOOS=linux go build -a -installsuffix cgo -o main .
# Runtime stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates tzdata ffmpeg curl wget
WORKDIR /root/
# Copy binary from builder
COPY --from=builder /app/main .
COPY --from=builder /app/static ./static
# Create data directory for SQLite database
RUN mkdir -p ./data
# Expose port
EXPOSE 3000
# Run the application
CMD ["./main"]