Skip to content

Build docker image in GitHub actions #5

Build docker image in GitHub actions

Build docker image in GitHub actions #5

Workflow file for this run

name: Test Backend - Build & Push
on:
push:
branches: [ "build-docker-image-in-github-actions" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Git Hash
run: echo "GIT_HASH=$(echo ${{ github.sha }} | cut -c1-7 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v6
with:
context: "./server"
platforms:
- linux/arm64

Check failure on line 32 in .github/workflows/test.yml

View workflow run for this annotation

GitHub Actions / Test Backend - Build & Push

Invalid workflow file

The workflow is not valid. .github/workflows/test.yml (Line: 32, Col: 13): A sequence was not expected .github/workflows/test.yml (Line: 35, Col: 13): A sequence was not expected
push: true
tags:
- acmucsd/hackathon-portal-api:${{ env.GIT_HASH }}
- acmucsd/hackathon-portal-api:latest