Skip to content

Build Image

Build Image #3

Workflow file for this run

name: Build Image
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build Container Image
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: geunsam2/cicd-example:latest
-
name: SSH Remote Commands
uses: appleboy/[email protected]
with:
host: mc.modutech.win
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: 22
timeout: 40s # 30초 기본
script: |
docker pull geunsam2/cicd-example:latest
docker rm -f example-container
docker run -d -p 41000:8000 --name example-container geunsam2/cicd-example:latest