add deployment
continuous-integration/drone/push Build is passing Details

main
adb-sh 2 years ago
parent 3387056120
commit bb1bf12de3

@ -0,0 +1,39 @@
---
kind: pipeline
type: docker
name: build
steps:
- name: docker
image: plugins/docker
settings:
registry: docker.cybre.town
repo: docker.cybre.town/adb/webprog-homework
tags: "latest"
username:
from_secret: docker_username
password:
from_secret: docker_password
---
kind: pipeline
type: docker
name: deploy
depends_on:
- build
steps:
- name: pull and deploy
image: appleboy/drone-ssh:linux-amd64
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_user_name
key:
from_secret: ssh_private_key
script: |
cd /media/docker/webprog-homework
docker compose -f docker-compose.prod.yml -p webprog-homework pull -q
docker compose -f docker-compose.prod.yml -p webprog-homework up -d

@ -0,0 +1,10 @@
FROM python:3-alpine
COPY ./ /usr/src/app
WORKDIR /usr/src/app
RUN pip install -r requirements.txt
RUN python ./manage.py migrate
EXPOSE 8000
CMD [ "python", "./manage.py", "runserver", "0.0.0.0:8000" ]

@ -0,0 +1,20 @@
version: '3'
networks:
web:
external: true
services:
frontend:
image: docker.cybre.town/adb/webprog-homework
labels:
- "traefik.enable=true"
- "traefik.http.routers.webprog-homework.rule=Host(`webprog-homework.deploy.cat`)"
- "traefik.http.routers.webprog-homework.entrypoints=https"
- "traefik.http.services.webprog-homework.loadbalancer.server.port=8000"
- "traefik.http.routers.webprog-homework.tls.certresolver=mytlschallenge"
- "traefik.docker.network=web"
volumes:
- ./db.sqlite:/usr/src/app/db.sqlite
networks:
- web

@ -0,0 +1,2 @@
Django==4.1.3
requests==2.28.1
Loading…
Cancel
Save