ci: add gitea pipeline
All checks were successful
Docker Image build / Build Container (push) Successful in 2m29s
All checks were successful
Docker Image build / Build Container (push) Successful in 2m29s
This commit is contained in:
parent
cac2bbcc6f
commit
913d59315f
72
.gitea/workflows/docker-image.yml
Normal file
72
.gitea/workflows/docker-image.yml
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
name: Docker Image build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
pull_request:
|
||||||
|
branches: ["main"]
|
||||||
|
schedule:
|
||||||
|
# * is a special character in YAML so you have to quote this string
|
||||||
|
- cron: "5 4 * * *"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push-container:
|
||||||
|
name: Build Container
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
git.dev-null.rocks/alexohneander/sim_free
|
||||||
|
tags: |
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDDHHMM'}}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
|
- name: Set up Docker Context for Buildx
|
||||||
|
id: buildx-context
|
||||||
|
run: |
|
||||||
|
export DOCKER_HOST=tcp://docker:2376/
|
||||||
|
export DOCKER_TLS_CERTDIR="/certs"
|
||||||
|
export DOCKER_TLS_VERIFY=1
|
||||||
|
export DOCKER_CERT_PATH="/certs/client"
|
||||||
|
docker context create builders
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
# buildkitd-flags: --debug
|
||||||
|
endpoint: builders
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: "tcp://docker:2376/"
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
DOCKER_TLS_VERIFY: 1
|
||||||
|
DOCKER_CERT_PATH: "/certs/client"
|
||||||
|
|
||||||
|
- name: Login to Gitea
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.dev-null.rocks
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.GA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push the image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: "tcp://docker:2376/"
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
DOCKER_TLS_VERIFY: 1
|
||||||
|
DOCKER_CERT_PATH: "/certs/client"
|
45
.github/workflows/docker-image.yml
vendored
45
.github/workflows/docker-image.yml
vendored
@ -1,45 +0,0 @@
|
|||||||
name: Docker Image build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: ["main"]
|
|
||||||
pull_request:
|
|
||||||
branches: ["main"]
|
|
||||||
schedule:
|
|
||||||
# * is a special character in YAML so you have to quote this string
|
|
||||||
- cron: "5 4 * * *"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build Docker image and push to repositories
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: login to hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v4
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: alexohneander/sim-free:latest
|
|
||||||
|
|
||||||
- name: deploying
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.SSH_HOST }}
|
|
||||||
username: ${{ secrets.SSH_USER }}
|
|
||||||
key: ${{ secrets.SSH_KEY }}
|
|
||||||
port: ${{ secrets.SSH_PORT }}
|
|
||||||
script: |
|
|
||||||
docker image pull alexohneander/sim-free:latest
|
|
||||||
docker container stop sim-free
|
|
||||||
docker container rm sim-free
|
|
||||||
docker container run -d --name sim-free -p 8000:8000 alexohneander/sim-free:latest
|
|
Loading…
x
Reference in New Issue
Block a user