-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
42 lines (28 loc) · 810 Bytes
/
dockerfile
File metadata and controls
42 lines (28 loc) · 810 Bytes
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
FROM node:14 as builder
COPY package.json .
COPY yarn.lock .
RUN yarn install --frozen-lockfile
COPY . .
ENV BASE_PATH="/blog"
ENV NODE_ENV=production
ARG gcp_project
RUN yarn build && rm -rf .next/cache
RUN yarn firebase-deploy-directory --project $gcp_project --subpath blog/_next/static --directory .next/static/ --commit
# Make smaller prod image
FROM node:14 as node_installer
ENV NODE_ENV=production
COPY package.json .
COPY yarn.lock .
RUN yarn install --production
FROM node:14
ENV BASE_PATH="/blog"
ENV NODE_ENV=production
COPY package.json .
COPY yarn.lock .
# Copies public environment variables
COPY .env.local .env
COPY server.js.example server.js
COPY next.config.js .
COPY --from=node_installer node_modules node_modules
COPY --from=builder .next .next
CMD [ "node", "server.js" ]