Skip to content

news/docker

news/docker #30

Workflow file for this run

name: news/docker
on:
workflow_run:
workflows: ["news/graphql"]
types: ["completed"]
env:
REGISTRY: ghcr.io
jobs:
deploy:
name: Publish news
runs-on: ubuntu-latest
permissions: write-all
steps:
- 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: Get GraphQL tag
id: "get-graphql-tag"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' graphql/Cargo.toml) >> $GITHUB_OUTPUT
- name: Build GraphQL image
run: |
docker build . -f docker/api/Dockerfile -t ghcr.io/gravitalia/news-api:latest
docker tag ghcr.io/gravitalia/news-graphql:latest ghcr.io/gravitalia/news-api:${{ steps.get-graphql-tag.outputs.PKG_VERSION }}
- name: Get ML tag
id: "get-ml-tag"
shell: "bash"
run: |
echo PKG_VERSION=$(awk -F ' = ' '/^version/ { gsub(/["]/, "", $2); print $2 }' machine_learning/pyproject.toml) >> $GITHUB_OUTPUT
- name: Build ML API image
run: |
docker build . -f docker/ml/Dockerfile -t ghcr.io/gravitalia/news-ml:latest
docker tag ghcr.io/gravitalia/news-ml:latest ghcr.io/gravitalia/news-ml:${{ steps.get-ml-tag.outputs.PKG_VERSION }}
- name: Publish images
run: |
docker push ghcr.io/gravitalia/news-api:latest
docker push ghcr.io/gravitalia/news-api:${{ steps.get-graphql-tag.outputs.PKG_VERSION }}
docker push ghcr.io/gravitalia/news-ml:latest
docker push ghcr.io/gravitalia/news-ml:${{ steps.get-ml-tag.outputs.PKG_VERSION }}