From 10295e2f2117ec187991d6283ada3b31452475a5 Mon Sep 17 00:00:00 2001 From: Aleksey Lobanov Date: Sun, 21 Jul 2024 22:07:01 +0300 Subject: [PATCH] ci: Add docker and registry integration --- .gitea/workflows/local-docker.yaml | 35 ++++++++++++++++++++++++++++++ Dockerfile | 14 ++++++++++++ README.md | 8 ++++++- 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/local-docker.yaml create mode 100644 Dockerfile diff --git a/.gitea/workflows/local-docker.yaml b/.gitea/workflows/local-docker.yaml new file mode 100644 index 0000000..1cbb50e --- /dev/null +++ b/.gitea/workflows/local-docker.yaml @@ -0,0 +1,35 @@ +name: Push to local registry +run-name: ${{ gitea.actor }} is pushing -> local Docker +on: [push] + + + +jobs: + build: + name: Build and push image + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest +jobs: + build: + name: Build and push image + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Docker Registry + uses: docker/login-action@v3 + with: + registry: gitea.likemath.ru + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + # platforms: linux/amd64,linux/arm64 + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bd7a4c2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM docker.io/python:3.12-slim as builder + +WORKDIR /app + +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +COPY requirements.txt . +RUN pip install -r requirements.txt + + +COPY *.py /app + +ENTRYPOINT ["python3", "main.py"] diff --git a/README.md b/README.md index 0505e2e..9ecdb8b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,9 @@ # s3-mirror -Full mirroring between two s3-targets with redundant files removing. \ No newline at end of file +Full mirroring between two s3-targets with redundant files removing. + +## Example with Docker +``` +docker build . -t s3-mirror +podman run -v ~/.mcli/config.json:/root/.mc/config.json:ro --rm s3-mirror +```