Skip to content

Commit

Permalink
GitHub Action script to deploy a Docker image to GitHub Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtamm committed Oct 12, 2023
1 parent 59e475d commit 7437a0d
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 21 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/demo.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/docker-image-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish Docker image

# Building and pushing a new Docker image when:
# > commit to master branch: ghcr.io/genomicdatainfrastructure/starter-kit-beacon2-ri-api:master
# > tagging with 'v'-prefix: ghcr.io/genomicdatainfrastructure/starter-kit-beacon2-ri-api:<semantic-version>
# > pull-request: ghcr.io/genomicdatainfrastructure/starter-kit-beacon2-ri-api:pr-<id>

on:
workflow_dispatch:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- 'master'

jobs:
build-and-push-image:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest

# Needs a permission to write to GitHub Packages:
permissions:
contents: read
packages: write

steps:
- name: Check out the repo
uses: actions/checkout@v4

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
# Indicates that the Docker build context is the current directory.
# Otherwise, it would be a Git URL (doing a separate clean checkout).
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 2 additions & 3 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ services:

beacon:
build: ..
image: egarchive/beacon:2.0
image: ghcr.io/genomicdatainfrastructure/starter-kit-beacon2-ri-api:master
hostname: beacon
container_name: beacon
volumes:
Expand All @@ -83,7 +83,7 @@ services:
###########################################

permissions:
image: egarchive/beacon:2.0
image: ghcr.io/genomicdatainfrastructure/starter-kit-beacon2-ri-api:master
hostname: beacon-permissions
container_name: beacon-permissions
volumes:
Expand All @@ -99,4 +99,3 @@ services:
#entrypoint: ['/bin/sleep','100000000']
working_dir: '/beacon'
entrypoint: ['python','-m', 'permissions']

0 comments on commit 7437a0d

Please sign in to comment.