Skip to content

Commit

Permalink
Adding workflow to deploy docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-noel committed Mar 12, 2024
1 parent 24fde9c commit dc14c43
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/deploy-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Linux

on:
release:
types: [created]

jobs:

publish_docker_hub:
name: Publishing WebMaBoSS docker to DockerHub
runs-on: ubuntu-22.04
if: github.event_name == 'release' && github.event.action == 'created' && github.repository == 'sysbio-curie/WebMaBoSS'

steps:
- uses: actions/checkout@v4

- name: Start WebMaBoSS docker
run: |
docker-compose build webmaboss
- name: Connect Docker Hub
run: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Upload Docker Hub
run: |
docker tag webmaboss:${{ github.event.release.tag_name }} webmaboss:latest
docker tag webmaboss:latest vnoel/webmaboss:latest
docker tag webmaboss:${{ github.event.release.tag_name }} vnoel/webmaboss:${{ github.event.release.tag_name }}
docker push vnoel/webmaboss:latest
docker push vnoel/webmaboss:${{ github.event.release.tag_name }}
docker tag webmaboss:latest sysbiocurie/webmaboss:latest
docker tag webmaboss:${{ github.event.release.tag_name }} sysbiocurie/webmaboss:${{ github.event.release.tag_name }}
docker push sysbiocurie/webmaboss:latest
docker push sysbiocurie/webmaboss:${{ github.event.release.tag_name }}
publish_docker_github:
name: Publishing WebMaBoSS docker container to GitHub
runs-on: ubuntu-22.04
if: github.event_name == 'release' && github.event.action == 'created' && github.repository == 'sysbio-curie/MaBoSS'

env:
REGISTRY: ghcr.io
IMAGE_NAME: webmaboss

permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit dc14c43

Please sign in to comment.