build frontend before UI

This commit is contained in:
Jason Kulatunga 2023-01-26 03:08:13 -08:00
parent 04c3c4d12a
commit a89f640bc0
4 changed files with 28 additions and 10 deletions

View File

@ -4,4 +4,4 @@
/.git /.git
/frontend/node_modules /frontend/node_modules
/frontend/.angular /frontend/.angular
/dist

View File

@ -28,10 +28,10 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 18.x node-version: 18.x
- name: Create Yarn Cache - name: Build Frontend
run: | run: |
cd frontend cd frontend
yarn install --frozen-lockfile make build-frontend-${{ github.ref_name == 'sandbox' && 'sandbox' || 'prod' }}
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v2 uses: docker/setup-qemu-action@v2

View File

@ -1,13 +1,21 @@
######################################################################################################### #########################################################################################################
# Frontend Build # Frontend Build
######################################################################################################### #########################################################################################################
FROM node:18 as frontend-build # !!!! GAH !!!!
ARG FASTEN_ENV=sandbox # https://blog.thesparktree.com/docker-multi-arch-github-actions#q-i-enabled-multi-arch-builds-and-my-builds-take-1h-what-gives
WORKDIR /usr/src/fastenhealth/frontend # https://github.com/fastenhealth/fasten-onprem/issues/43
COPY frontend/ ./
#make sure you run `make frontend-build-sandbox` or `make frontend-build-main` before `docker build .`
#FROM node:18 as frontend-build
#ARG FASTEN_ENV=sandbox
#WORKDIR /usr/src/fastenhealth/frontend
#COPY frontend/ ./
#
#RUN yarn install --frozen-lockfile && \
# yarn run build -- --configuration ${FASTEN_ENV} --output-path=../dist
RUN yarn install --frozen-lockfile && \
yarn run build -- --configuration ${FASTEN_ENV} --output-path=../dist
######################################################################################################### #########################################################################################################
# Backend Build # Backend Build
@ -37,7 +45,7 @@ FROM gcr.io/distroless/static-debian11
WORKDIR /opt/fasten/ WORKDIR /opt/fasten/
COPY --from=backend-build /opt/fasten/ /opt/fasten/ COPY --from=backend-build /opt/fasten/ /opt/fasten/
COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/web COPY dist/ /opt/fasten/web/
COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten
COPY LICENSE.md /opt/fasten/LICENSE.md COPY LICENSE.md /opt/fasten/LICENSE.md
COPY config.yaml /opt/fasten/config/config.yaml COPY config.yaml /opt/fasten/config/config.yaml

View File

@ -37,6 +37,16 @@ frontend-dep:
cd frontend cd frontend
yarn install --frozen-lockfile yarn install --frozen-lockfile
.PHONY: frontend-build-sandbox
frontend-build-sandbox: frontend-dep
cd frontend
yarn run build -- --configuration sandbox --output-path=../dist
.PHONY: frontend-build-prod
frontend-build-sandbox: frontend-dep
cd frontend
yarn run build -- --configuration prod --output-path=../dist
.PHONY: frontend-test .PHONY: frontend-test
# reduce logging, disable angular-cli analytics for ci environment # reduce logging, disable angular-cli analytics for ci environment
frontend-test: frontend-dep frontend-test: frontend-dep