diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index aab5637..abea909 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,16 +1,35 @@ -name: Fly Deploy +name: Docker Deploy on: push: - branches: - - main + branches: [main] + pull_request: + branches: [main] jobs: - deploy: - name: Deploy app + build-and-push: runs-on: ubuntu-latest - concurrency: deploy-group # optional: ensure only one action runs at a time + permissions: + contents: read + packages: write steps: - - uses: actions/checkout@v4 - - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --remote-only - env: - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Container Registry + uses: docker/login-action@v2 + with: + registry: ${{ secrets.REPO_HOST }} + username: ${{ github.repository_owner }} + password: ${{ secrets.DEPLOY_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64 + push: true + tags: | + ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} + ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest diff --git a/docker-compose.yml b/docker-compose.yml index abea909..b044330 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,35 +1,20 @@ -name: Docker Deploy -on: - push: - branches: [main] - pull_request: - branches: [main] -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout code - uses: actions/checkout@v3 +services: + himbot: + build: . + container_name: himbot + ports: + - "3000:3000" + environment: + - DISCORD_TOKEN=${DISCORD_TOKEN} + - DATABASE_URL=${DATABASE_URL} + - DATABASE_AUTH_TOKEN=${DATABASE_AUTH_TOKEN} + volumes: + - ${ROOT_DIR}/himbot_data:/data + depends_on: + - db - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Container Registry - uses: docker/login-action@v2 - with: - registry: ${{ secrets.REPO_HOST }} - username: ${{ github.repository_owner }} - password: ${{ secrets.DEPLOY_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v4 - with: - context: . - platforms: linux/amd64 - push: true - tags: | - ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} - ${{ secrets.REPO_HOST }}/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest + db: + image: nouchka/sqlite3 + container_name: himbot_db + volumes: + - ${ROOT_DIR}/himbot_data:/data