generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Dockerfile
54 lines (42 loc) · 1.28 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
FROM node:lts-bullseye-slim as clientBuilder
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN mkdir /app
WORKDIR /app
COPY client/package.json .
COPY client/package-lock.json .
RUN npm ci
COPY client .
ENV NODE_ENV "production"
RUN npm run build
RUN echo package.json
# Server Build Container
FROM node:lts-bullseye-slim as serverBuilder
WORKDIR /usr/src
COPY tsconfig.json ./
WORKDIR /usr/src/app
RUN mkdir build
COPY ./server/tsconfig.json ./
COPY ./server/package.json ./
COPY ./server/package-lock.json ./
COPY ./server/middleware/ ./middleware
COPY ./server/types/ ./types
COPY ./server/app/ ./app
COPY ./server/server.ts ./
RUN npm ci --quiet && npm run build
# Server Container
FROM node:lts-bullseye-slim
LABEL maintainer.fola="[email protected]"
LABEL org.hackforla="Hack For LA"
LABEL description="Food Oasis app"
WORKDIR /fola
COPY ./server/package.json ./
COPY ./server/package-lock.json ./
RUN npm ci --quiet
COPY --from=serverBuilder /usr/src/app/build ./
COPY ./server/uploads ./uploads
COPY --from=clientBuilder app/dist ./client/build
# we don't want to run as sudo so create group and user
RUN groupadd -r fola && useradd --no-log-init -r -g fola fola
USER fola
EXPOSE 5001
ENTRYPOINT ["/usr/local/bin/node", "./server.js"]