Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Docker Image workflow #17

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Deploy Docker Image

on:
push:
branches:
- main
- docker_workflow
tags:
- 'v*.*.*'
workflow_dispatch:

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: false
tags: ghcr.io/ncar/chemistry-cafe-api:build-temp

- name: Build and push Docker image (latest)
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/ncar/chemistry-cafe-api:latest

- name: Build and push Docker image (tagged)
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/ncar/chemistry-cafe-api:${{ github.ref_name }}
Loading