diff --git a/.dockerignore b/.dockerignore index e4e1cc35..a8faf8d1 100644 --- a/.dockerignore +++ b/.dockerignore @@ -4,4 +4,4 @@ /.git /frontend/node_modules /frontend/.angular - +/dist diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 97dddcc0..e435b7a6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,25 +20,13 @@ jobs: permissions: contents: read packages: write + id-token: write steps: - name: Checkout repository uses: actions/checkout@v2 - - name: Set Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - - name: Build Frontend - run: | - make frontend-build-${{ github.ref_name == 'sandbox' && 'sandbox' || 'prod' }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - image: 'tonistiigi/binfmt:latest' - platforms: 'amd64,arm64' - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + - name: Set up depot.dev multi-arch runner + uses: depot/setup-action@v1 # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} @@ -55,7 +43,7 @@ jobs: uses: docker/metadata-action@v4 with: flavor: | - latest=false + latest=${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }} tags: | type=ref,enable=true,event=branch type=ref,enable=true,event=tag @@ -63,8 +51,9 @@ jobs: # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: depot/build-push-action@v1 with: + project: vhwr5r7tw1 platforms: linux/amd64,linux/arm64 context: . file: Dockerfile @@ -73,5 +62,3 @@ jobs: labels: ${{ steps.meta.outputs.labels }} build-args: | FASTEN_ENV=${{ github.ref_name == 'sandbox' && 'sandbox' || 'prod' }} -# cache-from: type=gha -# cache-to: type=gha,mode=max diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 267f35ce..2547dc95 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,7 @@ jobs: go install github.com/golang/mock/mockgen@v1.6.0 go generate ./... make backend-test-coverage - CGO_ENABLED=0 go build ./backend/cmd/fasten/ + CGO_ENABLED=0 go build -buildvcs=false ./backend/cmd/fasten/ - name: Upload coverage uses: actions/upload-artifact@v3 with: diff --git a/Dockerfile b/Dockerfile index afa7cb8d..afaa79e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,22 @@ ######################################################################################################### # Frontend Build ######################################################################################################### -# !!!! GAH !!!! +# Note, when running on Github, we cannot use standard Github Action runners, as ARM support is only via QEMU emulation +# (until https://github.com/actions/runner-images/issues/2187) +# QEMU emulation has a bunch of performance issues, as described in the links below. # https://blog.thesparktree.com/docker-multi-arch-github-actions#q-i-enabled-multi-arch-builds-and-my-builds-take-1h-what-gives # https://github.com/fastenhealth/fasten-onprem/issues/43 - -#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 +# instead, we use https://depot.dev/ to do our multi-arch builds on native ARM and AMD nodes. +FROM node:18 as frontend-build +ARG FASTEN_ENV=sandbox +WORKDIR /usr/src/fastenhealth/frontend +COPY frontend/package.json frontend/yarn.lock ./ +RUN yarn install --frozen-lockfile +COPY frontend/ ./ +RUN yarn run build -- --configuration ${FASTEN_ENV} --output-path=../dist ######################################################################################################### # Backend Build @@ -45,7 +46,7 @@ FROM gcr.io/distroless/static-debian11 WORKDIR /opt/fasten/ COPY --from=backend-build /opt/fasten/ /opt/fasten/ -COPY dist/ /opt/fasten/web/ +COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/web COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten COPY LICENSE.md /opt/fasten/LICENSE.md COPY config.yaml /opt/fasten/config/config.yaml diff --git a/README.md b/README.md index 1e7d7584..fd982594 100644 --- a/README.md +++ b/README.md @@ -117,3 +117,7 @@ Jason Kulatunga - Initial Development - @AnalogJ # Sponsors Fasten is only possible with the help of my [Github Sponsors](https://github.com/sponsors/AnalogJ/) and Reddit supporters! + +I'd also like to thank the following Corporate Sponsors: + +