-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
49 lines (29 loc) · 1.03 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
FROM --platform=${BUILDPLATFORM} node:20.12.2-bullseye AS node-builder
WORKDIR /build
COPY frontend/package.json frontend/yarn.lock ./
RUN yarn config set registry 'https://registry.npmmirror.com' && \
yarn install
COPY frontend .
RUN yarn build-only
FROM golang:1.23.0-alpine3.20 AS go-builder
WORKDIR /build
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk add --no-cache ca-certificates make git zip && \
go env -w GOPROXY=https://goproxy.cn,direct
COPY server/Makefile server/go.mod server/go.sum ./
RUN make deps
COPY server .
COPY VERSION /
COPY --from=node-builder /build/dist ./server/static
ARG COMMIT_ID
RUN make deps && make build COMMIT=${COMMIT_ID}
FROM alpine:3.20
WORKDIR /app
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \
apk add --no-cache ca-certificates bash
RUN addgroup -S tos && adduser -S tos -G tos
RUN chown -R tos:tos /app
USER tos
COPY --from=go-builder /build/bin/tos /app/
EXPOSE 61296
ENTRYPOINT ["/app/tos"]