-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.core
48 lines (28 loc) · 906 Bytes
/
Dockerfile.core
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
FROM node:alpine AS node-builder
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN npm i -g pnpm
WORKDIR /build
COPY web/package.json web/pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY web .
RUN pnpm run build
FROM golang:alpine AS go-builder
RUN go env -w CGO_ENABLED=0
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
COPY --from=node-builder /build/dist ./web/dist
RUN go build -trimpath -ldflags '-extldflags "-static -fpic" -s -w' -tags="web nomsgpack" -o core ./cmd/core
FROM alpine:latest
RUN apk update && \
apk upgrade --no-cache && \
apk add --no-cache tzdata ca-certificates && \
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo 'Asia/Shanghai' >/etc/timezone && \
rm -rf /var/cache/apk/*
WORKDIR /data
COPY --from=go-builder /build/core /usr/bin/core
RUN chmod +x /usr/bin/core
ENTRYPOINT [ "/usr/bin/core" ]