forked from WordPress/openverse-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
60 lines (38 loc) · 1.18 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
FROM node:16-alpine as builder
# Install system packages needed to build on macOS
RUN apk add --no-cache --virtual .gyp python3 make g++ \
&& npm install -g pnpm
USER node
WORKDIR /home/node/app
COPY --chown=node:node pnpm-lock.yaml .
# install dependencies including local development tools
RUN pnpm fetch
# copy the rest of the content
COPY --chown=node:node . /home/node/app
# Prevent pre-commit from being installed, we don't need it here and it fails to install anyway
ENV SKIP_PRE_COMMIT=true
RUN pnpm install -r --offline
# disable telemetry when building the app
ENV NUXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production
ARG API_URL
ARG RELEASE
RUN echo "{\"release\":\"${RELEASE}\"}" > /home/node/app/src/static/version.json
RUN pnpm i18n
RUN pnpm build:only
###################
# Nuxt app
###################
FROM node:16-alpine as app
# Install CURL for the production healthcheck
RUN apk --no-cache add curl
WORKDIR /home/node/app
USER node
COPY --from=builder --chown=node:node /home/node/app .
# set app serving to permissive / assigned
ENV NUXT_HOST=0.0.0.0
# set application port
ENV PORT=8443
# expose port 8443 by default
EXPOSE 8443
ENTRYPOINT [ "npm", "start", "--" ]