From 4f58c7f5ebbefe7b7bebdc499286ad2fc59d3d0b Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sat, 21 Oct 2023 20:19:27 +0800 Subject: [PATCH] chore: add docker build workflow --- .github/workflows/docker-publish.yml | 33 ++++++++++++++++++++++++++++ docker-compose.yml | 9 +++----- 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..b2fdc4f --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,33 @@ +name: "Docker Publish" + +on: + workflow_dispatch: + push: + tags: + - 'v*.*.*' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: moonrailgun/tianji + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docker-compose.yml b/docker-compose.yml index a544354..12b5291 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,15 @@ version: '3' services: tianji: - image: tianji - build: - context: . + image: moonrailgun/tianji ports: - "12345:12345" environment: DATABASE_URL: postgresql://tianji:tianji@db:5432/tianji JWT_SECRET: replace-me-with-a-random-string - ALLOW_REGISTER: false + ALLOW_REGISTER: "false" depends_on: - db: - condition: service_healthy + - postgres restart: always postgres: image: postgres:15.4-alpine