This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
86 lines (65 loc) · 2.47 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# Copyright 2022 Puggies Authors (see AUTHORS.txt)
#
# This file is part of Puggies.
#
# Puggies is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# Puggies is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
# License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Puggies. If not, see <https://www.gnu.org/licenses/>.
FROM golang:1.17.6-alpine as backendBuilder
WORKDIR /workspace
# we will grab the SSL certs and timezone data so people
# don't have to mount this from their host machine
RUN apk update --no-cache && apk add --no-cache ca-certificates && apk --no-cache add tzdata
ENV CGO_ENABLED=0
COPY ./backend/go.mod ./backend/go.sum ./
RUN go mod download -x
COPY ./backend/src .
RUN go build -ldflags "-s -w" -o puggies .
FROM node:lts-alpine as frontendBuilder
WORKDIR /workspace
ENV PUBLIC_URL=/app
COPY ./frontend/package.json ./frontend/tsconfig.json ./frontend/yarn.lock ./
RUN yarn install
ENV NODE_ENV=production
COPY ./frontend/public ./public
COPY ./frontend/src ./src
RUN yarn build
FROM scratch
WORKDIR /
ENV GIN_MODE=release
# None of these variables should need to be changed, the defaults are setup to work
# with the docker container. Only change these if you know what you're doing!!
# ENV PUGGIES_DATA_PATH=/data
# ENV PUGGIES_DEMOS_PATH=/demos
# ENV PUGGIES_STATIC_PATH=/frontend/build
# ENV PUGGIES_ASSETS_PATH=/backend/assets
# ENV PUGGIES_MIGRATIONS_PATH=/backend/migrations
# ENV PUGGIES_FRONTEND_PATH=/app
# ENV PUGGIES_HTTP_PORT=9115
# ENV PUGGIES_DEMOS_RESCAN_INTERVAL_MINUTES=180
# ENV PUGGIES_TRUSTED_PROXIES=""
# ENV PUGGIES_DEBUG="0"
COPY --from=backendBuilder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=backendBuilder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY ./LICENSE /frontend/build/LICENSE.txt
COPY ./backend/assets /backend/assets
COPY ./backend/migrations /backend/migrations
COPY --from=backendBuilder \
/workspace/puggies \
/backend/puggies
COPY --from=frontendBuilder \
/workspace/build \
/frontend/build
COPY ./puggies-src.tar.gz /frontend/build/
EXPOSE 9115/tcp
ENTRYPOINT ["/backend/puggies"]
CMD ["serve"]