diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..a2528d6 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Build and Push Multi-Arch Docker Image + +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 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} + ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest diff --git a/.github/workflows/fly-deploy.yml b/.github/workflows/fly-deploy.yml deleted file mode 100644 index b0c246e..0000000 --- a/.github/workflows/fly-deploy.yml +++ /dev/null @@ -1,18 +0,0 @@ -# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ - -name: Fly Deploy -on: - push: - branches: - - main -jobs: - deploy: - name: Deploy app - runs-on: ubuntu-latest - concurrency: deploy-group # optional: ensure only one action runs at a time - 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 }} diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5163a59 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,38 @@ +services: + app: + image: ghcr.io/atridadl/pollo:latest + command: ["/app"] + depends_on: + db: + condition: service_healthy + ports: + - "3002:3000" + environment: + - POSTGRES_HOST=db + - POSTGRES_PORT=5432 + - POSTGRES_DB=pollo + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - AUTH_SECRET=${AUTH_SECRET} + - ENCRYPTION_KEY=${ENCRYPTION_KEY} + - DEVMODE=${DEVMODE} + + db: + image: "postgres:16-alpine" + environment: + - POSTGRES_DB=pollo + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_USER=${POSTGRES_USER} + ports: + - 5432:5432 + volumes: + - pgdata:/var/lib/postgresql/data + restart: on-failure:3 + healthcheck: + test: ["CMD", "sh", "-c", "pg_isready -h db -p 5432 -U ${POSTGRES_USER}"] + interval: 10s + timeout: 5s + retries: 10 + +volumes: + pgdata: