36 lines
621 B
Docker
36 lines
621 B
Docker
# build environment
|
|
FROM node:14-slim as builder
|
|
WORKDIR /app
|
|
|
|
ARG OWN_NPM_TOKEN
|
|
COPY .npmrc .npmrc
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
RUN rm -f .npmrc
|
|
|
|
COPY . ./
|
|
#RUN ls
|
|
RUN npm run build
|
|
|
|
# production environment
|
|
FROM node:14-slim
|
|
ARG APP_SUBFOLDER=""
|
|
|
|
COPY --from=builder /app/build ./application${APP_SUBFOLDER}
|
|
COPY --from=builder /app/build/index.html ./application/
|
|
|
|
#install static server
|
|
RUN npm install -g serve
|
|
|
|
# environment variables
|
|
ENV Author="Tudor Stanciu"
|
|
ARG APP_VERSION=0.0.0
|
|
ENV APP_VERSION=${APP_VERSION}
|
|
|
|
#set workdir to root
|
|
WORKDIR /
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["sh", "-c", "serve -s application -p 80"]
|