Setting up traefik and letsencrypt #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create and publish docker image to Github | |
on: | |
push: | |
branches: ['dev'] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build and push api Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: api/ | |
push: true | |
tags: ghcr.io/glesage/frodo-api:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
env: | |
DATABASE_URL: postgresql://${{ secrets.PG_USER }}:${{ secrets.PG_PASS }}@db:5432/sam | |
- name: Build and push admin Docker image | |
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 | |
with: | |
context: admin/ | |
push: true | |
tags: ghcr.io/glesage/frodo-admin:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Docker Compose Remote Deploy api | |
uses: glesage/docker-compose-remote-action@v1.4 | |
with: | |
service: api | |
project_name: frodo | |
ssh_host: 170.64.163.217 | |
ssh_user: sam | |
ssh_key: ${{ secrets.DO_SSH_KEY }} | |
known_host_key: ${{ secrets.DO_HOST_KEY }} | |
pull: true | |
env: | |
PG_USER: ${{ secrets.PG_USER }} | |
PG_PASS: ${{ secrets.PG_PASS }} | |
DATABASE_URL: postgresql://${{ secrets.PG_USER }}:${{ secrets.PG_PASS }}@db:5432/sam | |
- name: Docker Compose Remote Deploy admin | |
uses: glesage/docker-compose-remote-action@v1.4 | |
with: | |
service: admin | |
project_name: frodo | |
ssh_host: 170.64.163.217 | |
ssh_user: sam | |
ssh_key: ${{ secrets.DO_SSH_KEY }} | |
known_host_key: ${{ secrets.DO_HOST_KEY }} | |
pull: true |