Skip to content

Instantly share code, notes, and snippets.

@juliavdkris
Last active July 13, 2024 18:01
Show Gist options
  • Save juliavdkris/922984e641da1438bf3e006fa324a783 to your computer and use it in GitHub Desktop.
Save juliavdkris/922984e641da1438bf3e006fa324a783 to your computer and use it in GitHub Desktop.
Alexandria CI/CD template
name: Docker build & push image
on:
push:
branches: [main]
workflow_dispatch:
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Set lowercase repository owner environment variable (funky workaround because Docker is dumb)
run: |
echo "OWNER_LOWERCASE=${OWNER,,}" >>${GITHUB_ENV}
env:
OWNER: '${{ github.repository_owner }}'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ env.OWNER_LOWERCASE }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push (server)
uses: docker/build-push-action@v6
with:
context: '{{defaultContext}}:server'
push: true
tags: ghcr.io/${{ env.OWNER_LOWERCASE }}/alexandria-server:latest
- name: Build and push (client)
uses: docker/build-push-action@v6
with:
context: '{{defaultContext}}:client'
push: true
tags: ghcr.io/${{ env.OWNER_LOWERCASE }}/alexandria-client:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment