ea7e175fde
* ci: improve GitHub Action to build and publish docker image * ci: increase the timeout for yarn steps * ci: fix build-args * ci: merge build GitHub Workflows into one * ci: add more logging * ci: Pack locally built dist into nginx container * ci: build actual app * ci: setup correct node version * ci: include dist in context * ci: use correct path to determine node version * ci: push images * ci: publish image * ci: login always to the hub * ci: remove debugging conditions Co-authored-by: Mikołaj Młodzikowski <mikolaj.mlodzikowski@gmail.com>
31 lines
788 B
Docker
31 lines
788 B
Docker
# Build container
|
|
FROM node:16.14.0-alpine as build
|
|
WORKDIR /app
|
|
# Argument to allow building of different apps
|
|
ARG APP
|
|
ENV PATH /app/node_modules/.bin:$PATH
|
|
COPY package.json ./
|
|
COPY yarn.lock ./
|
|
COPY . ./
|
|
RUN apk add python3 make gcc g++
|
|
RUN yarn --network-timeout 100000 --verbose --pure-lockfile
|
|
RUN yarn nx export $APP --network-timeout 100000 --verbose --pure-lockfile
|
|
|
|
# Production environment
|
|
FROM nginx:stable-alpine
|
|
ARG APP
|
|
COPY --from=build /app/dist/apps/$APP/exported /usr/share/nginx/html
|
|
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
WORKDIR /usr/share/nginx/html
|
|
COPY ./env.sh .
|
|
COPY ./apps/$APP/.env .env
|
|
|
|
# Add bash
|
|
RUN apk add --no-cache bash
|
|
|
|
RUN chmod +x ./env.sh
|
|
CMD ["/bin/bash", "-c", "/usr/share/nginx/html/env.sh && nginx -g \"daemon off;\""]
|