-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
45 lines (32 loc) · 1.29 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
FROM golang:1.23 AS builder
ARG PLAYTIME_EJS_REPO_URL
ARG PLAYTIME_EJS_REVISION
ARG PLAYTIME_EJS_CORES_URL
ENV DEBIAN_FRONTEND=noninteractive
ADD . /build
RUN apt-get update &&\
apt-get install -y curl git gpg wget zip unzip &&\
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor >> /nodesource-key.gpg &&\
echo "deb [signed-by=/nodesource-key.gpg] https://deb.nodesource.com/node_20.x bookworm main" >> /etc/apt/sources.list.d/nodesource.list &&\
echo "deb-src [signed-by=/nodesource-key.gpg] https://deb.nodesource.com/node_20.x bookworm main" >> /etc/apt/sources.list.d/nodesource.list &&\
apt-get install -y nodejs npm &&\
cd /build &&\
CGO_ENABLED=0 GOOS=linux go build -a -o app . &&\
./install.sh
###############################################################################
FROM ubuntu:22.04
COPY --from=builder /build/assets /app/assets/
COPY --from=builder /build/templates /app/templates/
COPY --from=builder /build/app /app/
ADD docker/run.sh /app/
ENV DEBIAN_FRONTEND=noninteractive
RUN useradd --user-group --system playtime &&\
cd /app &&\
mkdir -m 0777 data uploads &&\
chmod 0777 /app &&\
chown -R playtime:playtime /app
USER playtime
WORKDIR /app
EXPOSE 3000
VOLUME ["/app/data", "/app/uploads"]
CMD ["./run.sh"]