-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
57 lines (45 loc) · 1.52 KB
/
Dockerfile
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
56
57
# Copyright (c) VirtualTam
# SPDX-License-Identifier: MIT
# Step 1: Build Go binaries
FROM golang:1.23-bookworm AS builder
ARG CGO_ENABLED=1
WORKDIR /app
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod go mod download
ADD . .
RUN --mount=type=cache,target=/root/.cache/go-build make build
# Step 2: Build the actual image
FROM debian:bookworm-slim
RUN --mount=type=cache,target=/var/lib/apt/lists \
--mount=type=cache,target=/var/cache/apt \
rm -f /etc/apt/apt.conf.d/docker-clean \
&& apt update \
&& apt install -y ca-certificates
RUN groupadd \
--gid 1000 \
sparklemuffin \
&& useradd \
--create-home \
--home-dir /var/lib/sparklemuffin \
--shell /bin/bash \
--uid 1000 \
--gid sparklemuffin \
sparklemuffin
COPY --from=builder /app/build/sparklemuffin /usr/local/bin/sparklemuffin
ENV \
SPARKLEMUFFIN_CSRF_KEY="csrf-secret-key" \
SPARKLEMUFFIN_DB_ADDR="postgres:5432" \
SPARKLEMUFFIN_DB_SSLMODE="disable" \
SPARKLEMUFFIN_DB_NAME="sparklemuffin" \
SPARKLEMUFFIN_DB_USER="sparklemuffin" \
SPARKLEMUFFIN_DB_PASSWORD="sparklemuffin" \
SPARKLEMUFFIN_HMAC_KEY="hmac-secret-key" \
SPARKLEMUFFIN_LISTEN_ADDR="0.0.0.0:8080" \
SPARKLEMUFFIN_METRICS_LISTEN_ADDR="127.0.0.1:8081" \
SPARKLEMUFFIN_PUBLIC_ADDR="http://localhost:8080" \
SPARKLEMUFFIN_LOG_FORMAT="json" \
SPARKLEMUFFIN_LOG_LEVEL="info"
EXPOSE 8080
USER sparklemuffin
WORKDIR /var/lib/sparklemuffin
CMD ["/usr/local/bin/sparklemuffin", "run"]