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
|
# .woodpecker.yml
|
||||||
steps:
|
steps:
|
||||||
- name: build-push
|
- name: build
|
||||||
image: docker
|
image: docker
|
||||||
when:
|
when:
|
||||||
- branch: master
|
- branch: master
|
||||||
- event: push
|
- event: push
|
||||||
commands:
|
commands:
|
||||||
- docker build . -t "$IMAGE_TAG"
|
- docker build . -t git.keannu1.duckdns.org/keannu125/drf_template
|
||||||
- echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY" --password-stdin -u "$REGISTRY_USERNAME"
|
- echo "$REGISTRY_PASSWORD" | docker login git.keannu1.duckdns.org --password-stdin -u "$REGISTRY_USERNAME"
|
||||||
- docker push "$IMAGE_TAG"
|
- docker push git.keannu1.duckdns.org/keannu125/drf_template
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
secrets: [IMAGE_TAG, REGISTRY, REGISTRY_USERNAME, REGISTRY_PASSWORD]
|
secrets: [REGISTRY_USERNAME, REGISTRY_PASSWORD]
|
||||||
- name: update deployment and reset database
|
- name: deploy
|
||||||
image: docker
|
image: docker
|
||||||
when:
|
when:
|
||||||
- branch: master
|
- branch: master
|
||||||
|
@ -23,10 +23,10 @@ steps:
|
||||||
- chmod 600 /root/.ssh/id_rsa
|
- chmod 600 /root/.ssh/id_rsa
|
||||||
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
|
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > /root/.ssh/config
|
||||||
- ssh root@10.0.10.4 '
|
- ssh root@10.0.10.4 '
|
||||||
cd "${PROJECT_DIR}";
|
cd "/mnt/nvme/files/docker projects/DRF-Template";
|
||||||
docker-compose down;
|
docker-compose down;
|
||||||
docker image rm "${IMAGE_TAG}" || true;
|
docker image rm git.keannu1.duckdns.org/keannu125/drf_template || true;
|
||||||
docker pull "${IMAGE_TAG}:latest";
|
docker pull git.keannu1.duckdns.org/keannu125/drf_template:latest;
|
||||||
docker volume rm "${IMAGE_TAG}_db_data" || true;
|
docker volume rm "git.keannu1.duckdns.org/keannu125/drf_template_db_data" || true;
|
||||||
docker compose up -d'
|
docker compose up -f docker-compose.prod.yml -d;'
|
||||||
secrets: [IMAGE_TAG, SSH_KEY, PROJECT_DIR]
|
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
|
- Create a copy of the `.env.sample` file and name it as `.env` in the same directory
|
||||||
- Populate .env with values
|
- 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!
|
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:
|
services:
|
||||||
# Django Backend
|
# Django Backend
|
||||||
# http://localhost:8000
|
|
||||||
django:
|
django:
|
||||||
env_file: .env
|
env_file: .env
|
||||||
build:
|
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