DO baybee

This commit is contained in:
Atridad Lahiji 2024-09-20 01:52:24 -06:00
parent 632568ecf7
commit 42ff0dfc3f
Signed by: atridad
SSH key fingerprint: SHA256:LGomp8Opq0jz+7kbwNcdfTcuaLRb5Nh0k5AchDDb438
3 changed files with 84 additions and 5 deletions

34
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: Build and Push Docker Image
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag atridad:${{ github.sha }}
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Tag images
run: |
docker tag atridad:${{ github.sha }} registry.digitalocean.com/${{ secrets.DIGITALOCEAN_REGISTRY }}/atridotdad:${{ github.sha }}
docker tag atridad:${{ github.sha }} registry.digitalocean.com/${{ secrets.DIGITALOCEAN_REGISTRY }}/atridotdad:latest
- name: Push images to DO Container Registry
run: |
docker push registry.digitalocean.com/${{ secrets.DIGITALOCEAN_REGISTRY }}/atridotdad:${{ github.sha }}
docker push registry.digitalocean.com/${{ secrets.DIGITALOCEAN_REGISTRY }}/atridotdad:latest

42
docker-compose.dev.yml Normal file
View file

@ -0,0 +1,42 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
image: pollo:latest
command: ["/app"]
pull_policy: build
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:

View file

@ -1,16 +1,14 @@
services:
app:
build:
context: .
dockerfile: Dockerfile
image: pollo:latest
image: registry.digitalocean.com/himboapps/pollo:latest
command: ["/app"]
pull_policy: build
depends_on:
db:
condition: service_healthy
ports:
- "3002:3000"
networks:
- proxy
environment:
- POSTGRES_HOST=db
- POSTGRES_PORT=5432
@ -40,3 +38,8 @@ services:
volumes:
pgdata:
networks:
proxy:
name: proxy
external: true