Skip to content

Update build process to play nice with Nx 20 #30

Update build process to play nice with Nx 20

Update build process to play nice with Nx 20 #30

Workflow file for this run

name: Deploy • Docker Hub
on:
pull_request:
branches:
- main
types: [closed]
# see: https://github.com/docker/build-push-action
jobs:
build-base-image-dev:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image and export
uses: docker/build-push-action@v5
with:
context: .
build-args: NODE_ENV=development
push: false
tags: pocnestjs-base-dev:latest
outputs: type=docker,dest=/tmp/pocnestjs-base-dev.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp/pocnestjs-base-dev.tar
build-base-image-prod:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build image and export
uses: docker/build-push-action@v5
with:
context: .
build-args: NODE_ENV=production
push: false
tags: pocnestjs-base-prod:latest
outputs: type=docker,dest=/tmp/pocnestjs-base-prod.tar
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp/pocnestjs-base-prod.tar
auth-service:
needs:
- build-base-image-dev
- build-base-image-prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Docker Hub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/auth-service/Dockerfile
push: true
tags: shimisnow/pocnestjs-auth-service:latest
financial-service:
needs:
- build-base-image-dev
- build-base-image-prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Docker Hub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/financial-service/Dockerfile
push: true
tags: shimisnow/pocnestjs-financial-service:latest
user-service:
needs:
- build-base-image-dev
- build-base-image-prod
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download development base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-dev
path: /tmp
- name: Load development base docker image
run: |
docker load --input /tmp/pocnestjs-base-dev.tar
docker image ls -a
- name: Download production base artifact
uses: actions/download-artifact@v4
with:
name: pocnestjs-base-prod
path: /tmp
- name: Load production base docker image
run: |
docker load --input /tmp/pocnestjs-base-prod.tar
docker image ls -a
- name: Docker Hub login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/user-service/Dockerfile
push: true
tags: shimisnow/pocnestjs-user-service:latest