mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 04:09:25 +08:00
Fix directory and image tags not being read properly
This commit is contained in:
parent
4c7a53047d
commit
07afe51618
4 changed files with 92 additions and 14 deletions
|
@ -1,18 +1,18 @@
|
|||
# .woodpecker.yml
|
||||
steps:
|
||||
- name: build-push
|
||||
- name: build
|
||||
image: docker
|
||||
when:
|
||||
- branch: master
|
||||
- event: push
|
||||
commands:
|
||||
- docker build . -t "$IMAGE_TAG"
|
||||
- echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" --password-stdin -u "$REGISTRY_USERNAME"
|
||||
- docker push "$IMAGE_TAG"
|
||||
- docker build . -t git.keannu1.duckdns.org/keannu125/drf_template
|
||||
- echo "$REGISTRY_PASSWORD" | docker login git.keannu1.duckdns.org --password-stdin -u "$REGISTRY_USERNAME"
|
||||
- docker push git.keannu1.duckdns.org/keannu125/drf_template
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
secrets: [IMAGE_TAG, REGISTRY, REGISTRY_USERNAME, REGISTRY_PASSWORD]
|
||||
- name: update deployment and reset database
|
||||
secrets: [REGISTRY_USERNAME, REGISTRY_PASSWORD]
|
||||
- name: deploy
|
||||
image: docker
|
||||
when:
|
||||
- branch: master
|
||||
|
@ -23,10 +23,10 @@ steps:
|
|||
- chmod 600 /root/.ssh/id_rsa
|
||||
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
|
||||
- ssh root@10.0.10.4 '
|
||||
cd "${PROJECT_DIR}";
|
||||
cd "/mnt/nvme/files/docker projects/DRF-Template";
|
||||
docker-compose down;
|
||||
docker image rm "${IMAGE_TAG}" || true;
|
||||
docker pull "${IMAGE_TAG}:latest";
|
||||
docker volume rm "${IMAGE_TAG}_db_data" || true;
|
||||
docker compose up -d'
|
||||
secrets: [IMAGE_TAG, SSH_KEY, PROJECT_DIR]
|
||||
docker image rm git.keannu1.duckdns.org/keannu125/drf_template || true;
|
||||
docker pull git.keannu1.duckdns.org/keannu125/drf_template:latest;
|
||||
docker volume rm "git.keannu1.duckdns.org/keannu125/drf_template_db_data" || true;
|
||||
docker compose up -f docker-compose.prod.yml -d;'
|
||||
secrets: [SSH_KEY]
|
||||
|
|
|
@ -18,7 +18,7 @@ This is a Django template that I personally use for my projects. This covers the
|
|||
|
||||
- Create a copy of the `.env.sample` file and name it as `.env` in the same directory
|
||||
- Populate .env with values
|
||||
- Run `docker-compose up`
|
||||
- Run `docker-compose up -f docker-compose.dev.yml`
|
||||
|
||||
Be sure to follow through the steps shown in the `stripe-listener` container for initial setup with Stripe!
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ version: "3.9"
|
|||
|
||||
services:
|
||||
# Django Backend
|
||||
# http://localhost:8000
|
||||
django:
|
||||
env_file: .env
|
||||
build:
|
79
docker-compose.prod.yml
Normal file
79
docker-compose.prod.yml
Normal file
|
@ -0,0 +1,79 @@
|
|||
version: "3.9"
|
||||
|
||||
services:
|
||||
# Django Backend
|
||||
django:
|
||||
env_file: .env
|
||||
image: git.keannu1.duckdns.org/keannu125/drf_template:latest
|
||||
ports:
|
||||
- "${BACKEND_PORT}:${BACKEND_PORT}"
|
||||
environment:
|
||||
- PYTHONBUFFERED=1
|
||||
- RUN_TYPE=web
|
||||
volumes:
|
||||
- .:/code
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
# Django Celery Worker
|
||||
celery:
|
||||
env_file: .env
|
||||
environment:
|
||||
- RUN_TYPE=worker
|
||||
image: git.keannu1.duckdns.org/keannu125/drf_template:latest
|
||||
volumes:
|
||||
- .:/code
|
||||
- ./chrome:/chrome
|
||||
- ./firefox:/firefox
|
||||
- ./dumps:/dumps
|
||||
depends_on:
|
||||
- django
|
||||
- postgres
|
||||
- redis
|
||||
## Runs multiple worker instances
|
||||
scale: 4
|
||||
|
||||
# Django Celery Beat
|
||||
celery_beat:
|
||||
env_file: .env
|
||||
environment:
|
||||
- RUN_TYPE=beat
|
||||
image: git.keannu1.duckdns.org/keannu125/drf_template:latest
|
||||
volumes:
|
||||
- .:/code
|
||||
depends_on:
|
||||
- celery
|
||||
- django
|
||||
- postgres
|
||||
- redis
|
||||
|
||||
# SQL Database
|
||||
postgres:
|
||||
env_file: .env
|
||||
image: postgres
|
||||
environment:
|
||||
- POSTGRES_DB=${DB_DATABASE}
|
||||
- POSTGRES_USER=${DB_USERNAME}
|
||||
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||
ports:
|
||||
- "${DB_PORT}:5432"
|
||||
volumes:
|
||||
- db-data:/var/lib/postgresql/data
|
||||
|
||||
# Redis Server
|
||||
redis:
|
||||
image: redis:latest
|
||||
ports:
|
||||
- "${REDIS_PORT}:6379"
|
||||
|
||||
# Stripe CLI Webhook Listener
|
||||
stripe-listener:
|
||||
env_file: .env
|
||||
image: stripe/stripe-cli:latest
|
||||
environment:
|
||||
- STRIPE_WEBHOOK_SECRET=${STRIPE_SECRET_WEBHOOK}
|
||||
- STRIPE_API_KEY=${STRIPE_SECRET_KEY}
|
||||
command: listen --forward-to django:8000/api/v1/stripe/webhook/
|
||||
|
||||
volumes:
|
||||
db-data:
|
Loading…
Reference in a new issue