This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
[Docker] - volume pour .env #4
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: Deploy The Archiver | |
on: | |
push: | |
branches: ["main"] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to private registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ secrets.REGISTRY_URL }} | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: "${{ secrets.REGISTRY_URL }}/the-archiver:latest" | |
- name: Executing remote ssh commands using password | |
uses: appleboy/ssh-action@v1.0.0 | |
with: | |
host: ${{ secrets.SERVER_URL }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWD }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
docker login -u ${{ secrets.REGISTRY_USERNAME }} -p ${{ secrets.REGISTRY_PASSWORD }} ${{ secrets.REGISTRY_URL }} | |
docker pull ${{ secrets.REGISTRY_URL }}/the-archiver:latest | |
docker rm -f the-archiver || true && docker run -d -v ${{ secrets.ENV_FILE }}:/usr/src/app/.env:ro --network infra --name the-archiver ${{ secrets.REGISTRY_URL }}/the-archiver:latest |