This commit is contained in:
Luke Gustafson
2024-11-27 01:14:03 +00:00
parent abbe5b1d94
commit ea66cb206c
3 changed files with 76 additions and 20 deletions

View File

@@ -12,37 +12,41 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
- name: Setup Node.js for Building Frontend
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install and Build Frontend
- name: Install Dependencies and Build Frontend
run: |
cd frontend
npm install
npm run build
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to Docker Registry (GHCR)
uses: docker/login-action@v2
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image
run: docker build -f Dockerfile -t ghcr.io/${{ github.repository_owner }}/ssh-project:${{ github.run_id }} .
- name: Lowercase repository owner
id: lowercase_repo_owner
run: echo "REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Push Docker image to GHCR
run: docker push ghcr.io/${{ github.repository_owner }}/ssh-project:${{ github.run_id }}
- name: Build and Push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/${{ env.REPO_OWNER }}/ssh-project:${{ github.run_id }}
- name: Post-build clean-up
run: docker system prune -af