return docker build for frontend and backend code outside in CI

Previously we built a Docker image just for the test,
but the introduction of multi-arch build in 9fbf0952
build also meant the push of the image, so it was
restricted only to the master branch.
This change re-introduces the Docker image build
outside the master branch, which is helpful
in pull requests.

We recently had a few frontend PRs which broke
the Docker image build silently, and that change
prevents it from happening.
This commit is contained in:
Dmitry Verkhoturov
2022-07-19 19:25:54 -05:00
committed by Umputun
parent 50785e0577
commit 2d2f2ab02a
8 changed files with 36 additions and 27 deletions
+4 -8
View File
@@ -2,13 +2,12 @@ FROM node:16.15.1-alpine as build-frontend-deps
ARG CI
ENV SKIP_FRONTEND_TEST=true
ENV CI=true
ADD frontend/package.json /srv/frontend/package.json
ADD frontend/pnpm-lock.yaml /srv/frontend/pnpm-lock.yaml
WORKDIR /srv/frontend
RUN
cd /srv/frontend && \
apk add --no-cache --update git && \
npm i -g pnpm && \
pnpm i
@@ -17,21 +16,18 @@ FROM node:16.15.1-alpine as build-frontend
ARG CI
ARG NODE_ENV=production
ENV SKIP_FRONTEND_TEST=true
ENV HUSKY_SKIP_INSTALL=true
COPY --from=build-frontend-deps /srv/frontend/node_modules /srv/frontend/node_modules
ADD frontend /srv/frontend
RUN cd /srv/frontend && \
npm run build && \
WORKDIR /srv/frontend
RUN npm run build && \
rm -rf ./node_modules
FROM umputun/baseimage:buildgo-v1.9.1 as build-backend
FROM umputun/baseimage:buildgo-v1.9.2 as build-backend
ARG GITHUB_TOKEN
ARG GITHUB_REF
ARG GITHUB_SHA
ENV SKIP_BACKEND_TEST=true
WORKDIR /build/backend
ADD backend /build/backend