-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDockerfile
34 lines (28 loc) · 870 Bytes
/
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
FROM golang:1.22-alpine AS builder
WORKDIR /app
#ENV GOPROXY=https://goproxy.cn,direct
COPY . .
RUN set -evx -o pipefail \
&& apk update \
&& apk add --no-cache git \
&& rm -rf /var/cache/apk/* \
&& go build -ldflags="-s -w" -o busuanzi main.go
FROM node:21-alpine AS ts-builder
WORKDIR /app
COPY ./dist .
RUN set -evx -o pipefail \
&& npm install -g pnpm \
&& pnpm install \
&& pnpm run build \
&& rm -rf node_modules \
&& rm -rf pnpm-lock.yaml \
&& rm -rf tsconfig.json
FROM alpine:3.16
WORKDIR /app
COPY --from=builder /app/busuanzi /app
COPY --from=ts-builder /app /app/dist
COPY --from=builder /app/config.yaml /app/config.yaml
COPY --from=builder /app/entrypoint.sh /app
RUN chmod +x /app/entrypoint.sh
EXPOSE 8080
ENTRYPOINT [ "sh", "entrypoint.sh" ]