2021-08-01 01:55:21 +03:00
|
|
|
# build environment
|
2022-12-19 01:30:02 +02:00
|
|
|
FROM node:14-slim as builder
|
2021-08-01 01:55:21 +03:00
|
|
|
WORKDIR /app
|
|
|
|
|
2022-12-03 02:11:49 +02:00
|
|
|
COPY .npmrc .npmrc
|
2021-08-01 01:55:21 +03:00
|
|
|
COPY package*.json ./
|
|
|
|
RUN npm install
|
2022-12-03 02:11:49 +02:00
|
|
|
RUN rm -f .npmrc
|
2021-08-01 01:55:21 +03:00
|
|
|
|
|
|
|
COPY . ./
|
|
|
|
RUN npm run build
|
|
|
|
|
|
|
|
# production environment
|
2022-12-19 01:30:02 +02:00
|
|
|
FROM node:14-slim
|
2021-08-01 01:55:21 +03:00
|
|
|
RUN printf '\n\n- Copy application files\n'
|
|
|
|
|
|
|
|
ARG APP_SUBFOLDER=cdn-admin
|
|
|
|
|
|
|
|
COPY --from=builder /app/build ./application/${APP_SUBFOLDER}
|
|
|
|
COPY --from=builder /app/build/index.html ./application/
|
|
|
|
|
|
|
|
#install static server
|
|
|
|
RUN npm install -g serve
|
|
|
|
|
|
|
|
#set workdir to root
|
|
|
|
WORKDIR /
|
|
|
|
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
CMD ["sh", "-c", "serve -s application -p 80"]
|