-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (26 loc) · 850 Bytes
/
Copy pathDockerfile
File metadata and controls
47 lines (26 loc) · 850 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
44
45
46
47
FROM node:22-alpine AS frontend-builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /build
COPY frontend/package.json frontend/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY frontend/ .
RUN pnpm build
FROM golang:1.25-alpine AS backend-builder
WORKDIR /build
COPY backend/go.mod backend/go.sum ./
RUN go mod download
COPY backend/ .
COPY --from=frontend-builder /build/build ./cmd/server/static
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /server ./cmd/server/
FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata \
&& adduser -D -h /app appuser
WORKDIR /app
COPY --from=backend-builder /server ./server
RUN mkdir -p /data && chown -R appuser:appuser /app /data
USER appuser
ENV PORT=8080
ENV DB_PATH=/data/stockpilot.db
EXPOSE 8080
VOLUME ["/data"]
ENTRYPOINT ["./server"]