-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (32 loc) · 1.02 KB
/
Dockerfile
File metadata and controls
37 lines (32 loc) · 1.02 KB
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
FROM node:18-alpine AS build
RUN apk add sqlite
USER node
RUN mkdir /home/node/tfc
WORKDIR /home/node/tfc
COPY --chown=node:node package.json yarn.lock ./
RUN yarn install --frozen-lockfile
USER root
RUN chown node /home/node/tfc
USER node
RUN mkdir dist
ADD stations.sqlite* /home/node/tfc/
USER root
RUN chown node /home/node/tfc/stations.sqli*
USER node
RUN sqlite3 stations.sqlite "VACUUM"
ADD . /home/node/tfc
RUN cp -r www dist/
RUN ./node_modules/.bin/nest build
RUN yarn install --prod
# that's huge... I guess that shouldn't be there...
RUN rm -rf node_modules/luhn-generator/update
FROM node:18-alpine
RUN set -x && apk update && apk upgrade && apk add --no-cache bind-tools
COPY --from=build /home/node/tfc/node_modules /home/node/tfc/node_modules
COPY --from=build /home/node/tfc/stations.sqlite /home/node/tfc/dist/
COPY --from=build /home/node/tfc/dist /home/node/tfc/dist
#RUN chown node /home/node/tfc/dist/stations.sqlite*
RUN chown node /home/node/tfc/dist/
WORKDIR /home/node/tfc/dist
USER node
CMD ["node", "main.js"]