-
Notifications
You must be signed in to change notification settings - Fork 119
/
Dockerfile
57 lines (43 loc) · 1.32 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
50
51
52
53
54
55
56
57
## first build the client
FROM node:16-buster
RUN mkdir -p /root/hanabi-live
WORKDIR /root/hanabi-live
COPY .env.example .env
COPY tsconfig.json tsconfig.json
COPY package.json package.json
COPY package-lock.json package-lock.json
COPY packages packages
COPY public public
RUN npm install
# needed only for git rev parse
COPY .git .git
RUN packages/client/build_client.sh
## then build the server
FROM golang:1.17-buster
RUN mkdir -p /root/hanabi-live
WORKDIR /root/hanabi-live
COPY .env.example .env
COPY server server
RUN server/build_server.sh
## remove src code and copy build artifacts into a minimal image
FROM alpine
ENTRYPOINT ["/bin/sh"]
# was compiled against gnu libc above; musl is decently compatible
# also needs git so server can get rev-parse head
RUN apk update && apk add --no-cache libc6-compat git
RUN mkdir -p /root/hanabi-live
WORKDIR /root/hanabi-live
# will need to be mounted on startup
RUN touch .env
COPY packages/data packages/data
COPY misc misc
RUN mkdir -p logs
COPY --from=0 /root/hanabi-live/public public
COPY --from=1 /root/hanabi-live/hanabi-live hanabi-live
RUN chmod +x hanabi-live
RUN mkdir -p server/src
# needed at runtime, these are not compiled in
COPY server/src/views/ server/src/views/
# only needed so server knows its git hash
COPY .git .git
CMD ["-c", "/root/hanabi-live/hanabi-live"]