40 lines
949 B
YAML
40 lines
949 B
YAML
name: Gitea CI/CD
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Login to Docker registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
registry: https://registry.rokoh.com
|
|
|
|
- name: Build Docker image
|
|
run: docker build . -t rokoh -f rokoh/Dockerfile
|
|
|
|
- name: Push Docker image to registry
|
|
run: docker push rokoh:latest registry.rokoh.com
|
|
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
|
- name: Install Docker
|
|
uses: docker/setup-action@v2
|
|
|
|
- name: Pull Docker image from registry
|
|
run: docker pull registry.rokoh.com/rokoh:${{ github.sha }}
|
|
|
|
- name: Run Docker container
|
|
run: docker run -d -p 6000:80 registry.rokoh.com/rokoh:${{ github.sha }}
|