Hermes Agent commited on
Commit
4fc829b
·
1 Parent(s): 4f823df

Update: build from buyi06/ds2api source repo

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -2
Dockerfile CHANGED
@@ -1,5 +1,39 @@
1
- # Updated: 2026-05-03 02:51 UTC
2
- FROM ghcr.io/cjackhwang/ds2api:latest
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  COPY --chmod=666 config.json /data/config.json
 
4
  ENV PORT=7860
5
  EXPOSE 7860
 
 
 
1
+ # Build from buyi06/ds2api source
2
+ # https://github.com/buyi06/ds2api
3
+
4
+ # Stage 1: Get source code
5
+ FROM alpine/git:v2.45.2 AS source
6
+ RUN apk add --no-cache git && \
7
+ git clone --depth 1 https://github.com/buyi06/ds2api.git /src
8
+
9
+ # Stage 2: Build webui
10
+ FROM node:24-alpine AS webui-builder
11
+ COPY --from=source /src/webui /app/webui
12
+ COPY --from=source /src/config.example.json /app/config.example.json
13
+ WORKDIR /app/webui
14
+ RUN npm ci && npm run build
15
+
16
+ # Stage 3: Build Go binary
17
+ FROM golang:1.24-alpine AS go-builder
18
+ RUN apk add --no-cache git
19
+ COPY --from=source /src /app
20
+ WORKDIR /app
21
+ RUN go mod download && \
22
+ CGO_ENABLED=0 GOOS=linux go build -buildvcs=false -ldflags="-s -w" -o /out/ds2api ./cmd/ds2api
23
+
24
+ # Stage 4: Runtime
25
+ FROM debian:bookworm-slim
26
+ WORKDIR /app
27
+ RUN apt-get update && \
28
+ apt-get install -y --no-install-recommends ca-certificates && \
29
+ rm -rf /var/lib/apt/lists/* && \
30
+ mkdir -p /data
31
+
32
+ COPY --from=go-builder /out/ds2api /usr/local/bin/ds2api
33
+ COPY --from=webui-builder /app/static/admin /app/static/admin
34
  COPY --chmod=666 config.json /data/config.json
35
+
36
  ENV PORT=7860
37
  EXPOSE 7860
38
+
39
+ CMD ["ds2api"]