🗑️ refactor(Dockerfile, next.config.js): remove entrypoint script and… #120
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 to Production | |
on: | |
push: | |
branches: ['main'] | |
jobs: | |
push_to_registries: | |
name: Push Docker image to multiple registries | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Create env file | |
shell: bash | |
env: | |
ENV_CONTENT: ${{ secrets.ENV_PROD }} | |
run: | | |
echo "$ENV_CONTENT" > .env | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push images | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/gengar-bark:latest | |
- name: Deploy to server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.HOST_USERNAME }} | |
key: ${{ secrets.HOST_SSHKEY }} | |
command_timeout: 20m | |
script: | | |
docker stop gengar-bark || true | |
docker rm gengar-bark || true | |
docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/gengar-bark:latest || true | |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/gengar-bark:latest | |
docker run -d --name gengar-bark \ | |
-p 3001:3000 \ | |
${{ secrets.DOCKERHUB_USERNAME }}/gengar-bark:latest |