-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
68 lines (47 loc) · 1.53 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
ARG PORT
ARG PUBLIC
ARG BUILD_REF
###################
# Build source
###################
FROM node:16-alpine as build
RUN mkdir -p /app/dist /app/source
WORKDIR /app
COPY source/server/package*.json /app/source/server/
RUN (cd /app/source/server && npm ci)
COPY source/voyager/package*.json /app/source/voyager/
RUN (cd /app/source/voyager && npm ci --legacy-peer-deps)
COPY source/ui/package*.json /app/source/ui/
RUN (cd /app/source/ui && npm ci)
COPY ./package*.json /app/
RUN npm ci
COPY source/server /app/source/server
RUN npm run build-server
# outputs files in /app/source/server/dist
COPY source/voyager /app/source/voyager
COPY source/ui /app/source/ui
RUN npm run build-ui
# outputs files in /app/dist
###################
# The actual container to be published
###################
FROM node:16-alpine
LABEL org.opencontainers.image.source=https://github.com/Holusion/eCorpus
LABEL org.opencontainers.image.description="eCorpus base image"
LABEL org.opencontainers.image.licenses=Apache
ENV PUBLIC=${PUBLIC:-false}
ENV PORT=${PORT:-8000}
ENV BUILD_REF=${BUILD_REF:-unknown}
ENV NODE_ENV=production
WORKDIR /app
COPY source/server/package*.json /app/
#might occasionally fail if the prebuilt version can't be downloaded,
# because it can't rebuild it locally
RUN npm ci --omit=dev
COPY ./source/server/migrations /app/migrations
COPY ./source/server/templates /app/templates
COPY --from=build /app/dist /app/dist
COPY --from=build /app/source/server/dist /app/server
VOLUME [ "/app/files" ]
EXPOSE ${PORT}
CMD node server/index.js