Skip to content

Dockerfile and docker-image.yml (github action) #6

Dockerfile and docker-image.yml (github action)

Dockerfile and docker-image.yml (github action) #6

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build-and-push:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and push Scantools Docker image'
run: |
DATE=$(date +%Y-%m-%d)
docker build . --tag ghcr.io/pablospe/lamar-benchmark/scantools:$DATE --target scantools
# if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
docker tag ghcr.io/pablospe/lamar-benchmark/scantools:$DATE \
ghcr.io/pablospe/lamar-benchmark/scantools:latest
docker push ghcr.io/pablospe/lamar-benchmark/scantools:$DATE
docker push ghcr.io/pablospe/lamar-benchmark/scantools:latest
# fi
- name: Build and push Lamar Docker image
run: |
DATE=$(date +%Y-%m-%d)
docker build . --tag ghcr.io/pablospe/lamar-benchmark/lamar:$DATE --target lamar
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
docker tag ghcr.io/pablospe/lamar-benchmark/lamar:$DATE \
ghcr.io/pablospe/lamar-benchmark/lamar:latest
docker push ghcr.io/pablospe/lamar-benchmark/lamar:$DATE
docker push ghcr.io/pablospe/lamar-benchmark/lamar:latest
fi