-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
47 lines (42 loc) · 1.65 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
FROM node:20 as NODE_BUILD
WORKDIR /Hi-Windom/Sillot/
ADD . /Hi-Windom/Sillot/
RUN apt-get update && \
apt-get install -y jq
RUN cd app && \
packageManager=$(jq -r '.packageManager' package.json) && \
if [ -n "$packageManager" ]; then \
npm install -g $packageManager; \
else \
echo "No packageManager field found in package.json"; \
npm install -g pnpm; \
fi && \
pnpm install --registry=http://registry.npmjs.org/ --silent && \
pnpm run docker:build
RUN apt-get purge -y jq
RUN apt-get autoremove -y
RUN rm -rf /var/lib/apt/lists/*
FROM golang:alpine as GO_BUILD
WORKDIR /Hi-Windom/Sillot/
COPY --from=NODE_BUILD /Hi-Windom/Sillot/ /Hi-Windom/Sillot/
ENV GO111MODULE=on
ENV CGO_ENABLED=1
RUN apk add --no-cache gcc musl-dev && \
cd kernel && go build --tags fts5 -v -ldflags "-s -w -X github.com/Hi-Windom/Sillot/kernel/util.Mode=prod" && \
mkdir /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/appearance/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/stage/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/guide/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/app/changelogs/ /opt/Sillot/ && \
mv /Hi-Windom/Sillot/kernel/kernel /opt/Sillot/ && \
find /opt/Sillot/ -name .git | xargs rm -rf
FROM alpine:latest
LABEL maintainer="Soltus<[email protected]>"
WORKDIR /opt/Sillot/
COPY --from=GO_BUILD /opt/Sillot/ /opt/Sillot/
RUN addgroup --gid 1000 sillot && adduser --uid 1000 --ingroup sillot --disabled-password sillot && apk add --no-cache ca-certificates tzdata && chown -R sillot:sillot /opt/Sillot/
ENV TZ=Asia/Shanghai
ENV RUN_IN_CONTAINER=true
EXPOSE 58131
USER sillot
ENTRYPOINT [ "/opt/Sillot/kernel" ]