-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (28 loc) · 860 Bytes
/
Dockerfile
File metadata and controls
42 lines (28 loc) · 860 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
# ---- Stage 1: Build frontend ----
FROM oven/bun:1 AS frontend-builder
WORKDIR /app/frontend
COPY frontend/package.json frontend/bun.lockb* ./
RUN bun install --frozen-lockfile
COPY frontend/ ./
RUN bun run build
# ---- Stage 2: Build Go binary ----
FROM golang:1.26-alpine AS go-builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=frontend-builder /app/frontend/dist ./internal/static/dist
ARG VERSION=dev
RUN CGO_ENABLED=0 GOOS=linux go build \
-ldflags="-s -w -X sleeparr/internal/version.Version=${VERSION}" \
-o sleeparr ./cmd/server
# ---- Stage 3: Final image ----
FROM alpine:3.19
RUN apk add --no-cache su-exec tzdata
WORKDIR /app
COPY --from=go-builder /app/sleeparr .
COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
VOLUME ["/config"]
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]