mirror of
https://github.com/skooner-k8s/skooner.git
synced 2026-02-14 17:49:55 +00:00
31 lines
775 B
Docker
31 lines
775 B
Docker
# Stage 1 - the build react app
|
|
FROM node:16.20.2-alpine as build-deps
|
|
WORKDIR /usr/src/app
|
|
COPY client/package.json client/package-lock.json ./
|
|
RUN npm i
|
|
|
|
COPY client/ ./
|
|
RUN npm run build
|
|
|
|
# Stage 2 - the production environment
|
|
FROM node:16.20.2-alpine
|
|
|
|
RUN apk add --no-cache tini
|
|
ENV NODE_ENV production
|
|
WORKDIR /usr/src/app
|
|
RUN chown -R node:node /usr/src/app/
|
|
EXPOSE 4654
|
|
|
|
COPY server/package.json server/package-lock.json ./
|
|
RUN npm i --production
|
|
|
|
COPY --from=build-deps /usr/src/app/build /usr/src/app/public
|
|
COPY /server ./
|
|
|
|
# USER 1000 is the "node" user
|
|
# This is to avoid the "container has runAsNonRoot and image has non-numeric user (node), cannot verify user is non-root"
|
|
# in clusters with PSP enabled
|
|
USER 1000
|
|
|
|
ENTRYPOINT ["/sbin/tini", "--", "node", "."]
|