73 lines
2.3 KiB
YAML
73 lines
2.3 KiB
YAML
name: build-docker
|
|
run-name: build-docker ${{ github.actor }}
|
|
on:
|
|
# push:
|
|
# tags:
|
|
# - v1.**
|
|
# branches:
|
|
# - 'main'
|
|
# branches:
|
|
# - 'release-*'
|
|
|
|
# Allow run workflow manually from Action tab
|
|
workflow_dispatch:
|
|
env:
|
|
REGISTRY: docker.frappet.com
|
|
CMS_IMAGE_NAME: demo/qualifying-exam-cms
|
|
CMS_IMAGE_TAG: 0.1.1
|
|
jobs:
|
|
# act --workflows .github/workflows/build.yaml --job remote-image -s DOCKER_USER -s DOCKER_PASS
|
|
# act -W .github/workflows/build.yaml -j remote-image -s DOCKER_USER -s DOCKER_PASS
|
|
remote-image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
# skip Set up QEMU because it fail on act and container
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
- name: Login in to registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{env.REGISTRY}}
|
|
username: ${{secrets.DOCKER_USER}}
|
|
password: ${{secrets.DOCKER_PASS}}
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
- name: Build and push docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: cms
|
|
# platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{env.REGISTRY}}/${{env.CMS_IMAGE_NAME}}:${{env.CMS_IMAGE_TAG}},${{env.REGISTRY}}/${{env.CMS_IMAGE_NAME}}:latest
|
|
- name: Remote Deployment
|
|
uses: appleboy/ssh-action@v0.1.8
|
|
with:
|
|
host: frappet.com
|
|
username: frappet
|
|
password: ${{ secrets.SSH_PASSWORD }}
|
|
port: 22
|
|
script: |
|
|
cd /home/frappet/docker/bma-ehr-recruit-qualifying-exam
|
|
docker-compose pull
|
|
docker-compose up -d
|
|
touch success
|
|
|
|
|
|
# act -W .github/workflows/build.yaml -j local-image
|
|
local-image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: "Check out code"
|
|
uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
- name: Build and push docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
context: cms
|
|
load: true
|
|
tags: ${{env.REGISTRY}}/${{env.CMS_IMAGE_NAME}}:${{env.CMS_IMAGE_TAG}},${{env.REGISTRY}}/${{env.CMS_IMAGE_NAME}}:latest
|
|
|