forked from jacob-ebey/remix-ecommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (33 loc) · 944 Bytes
/
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
FROM node:17-bullseye-slim as base
ENV NODE_ENV=production
ENV PORT=8080
FROM base as builder
RUN apt-get update
RUN apt-get install build-essential python3 -y
# install all node_modules, including dev
FROM builder as deps
RUN mkdir /app/
WORKDIR /app/
ADD package.json package-lock.json ./
RUN npm install --production=false
# install only production modules
FROM deps as production-deps
WORKDIR /app/
RUN npm prune --production=true
## build the app
FROM deps as build
WORKDIR /app/
ADD . .
RUN npm run build
## copy over assets required to run the app
FROM base
RUN mkdir /app/
WORKDIR /app/
# ADD prisma .
COPY --from=production-deps /app/node_modules /app/node_modules
COPY --from=production-deps /app/package.json /app/package.json
COPY --from=production-deps /app/package-lock.json /app/package-lock.json
COPY --from=build /app/build /app/build
COPY --from=build /app/public /app/public
EXPOSE 8080
CMD ["npm", "start"]