Pls
This commit is contained in:
parent
788ea433c3
commit
7915a9e9c7
2 changed files with 28 additions and 21 deletions
47
.github/workflows/deploy.yml
vendored
47
.github/workflows/deploy.yml
vendored
|
@ -1,35 +1,42 @@
|
||||||
name: Build and Push Docker Image to DO Container Registry
|
name: Build and Push Multi-Arch Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Build the Docker image
|
- name: Set up QEMU
|
||||||
run: docker build . --file Dockerfile --tag ${{ github.event.repository.name }}:${{ github.sha }}
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
- name: Install doctl
|
- name: Set up Docker Buildx
|
||||||
uses: digitalocean/action-doctl@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Log in to DO Container Registry
|
- name: Build and push
|
||||||
run: doctl registry login --expiry-seconds 600
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
- name: Tag images
|
context: .
|
||||||
run: |
|
platforms: linux/amd64,linux/arm64
|
||||||
docker tag ${{ github.event.repository.name }}:${{ github.sha }} ${{ secrets.DIGITALOCEAN_REGISTRY }}/${{ github.event.repository.name }}:${{ github.sha }}
|
push: true
|
||||||
docker tag ${{ github.event.repository.name }}:${{ github.sha }} ${{ secrets.DIGITALOCEAN_REGISTRY }}/${{ github.event.repository.name }}:latest
|
tags: |
|
||||||
|
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
|
||||||
- name: Push images to DO Container Registry
|
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
|
||||||
run: |
|
|
||||||
docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}/${{ github.event.repository.name }}:${{ github.sha }}
|
|
||||||
docker push ${{ secrets.DIGITALOCEAN_REGISTRY }}/${{ github.event.repository.name }}:latest
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: registry.digitalocean.com/himboreg/pollo:latest
|
image: ghcr.io/atridadl/pollo:latest
|
||||||
command: ["/app"]
|
command: ["/app"]
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
|
|
Loading…
Add table
Reference in a new issue