mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-04-04 17:11:32 +08:00
Compare commits
10 commits
29ba67dc7a
...
de47b1ea4b
Author | SHA1 | Date | |
---|---|---|---|
de47b1ea4b | |||
e0cd05e7a9 | |||
193f10ca25 | |||
b632d9681b | |||
9e2954940f | |||
673c4903e2 | |||
5ae64a2b8e | |||
a9b5bf30dd | |||
61759e37cd | |||
aa221e3382 |
2 changed files with 50 additions and 24 deletions
|
@ -4,15 +4,6 @@ labels:
|
|||
steps:
|
||||
- name: build
|
||||
image: docker
|
||||
when:
|
||||
- branch: master
|
||||
event: push
|
||||
commands:
|
||||
- docker build -t "$REGISTRY_IMAGE_TAG" .
|
||||
- echo "$FORGEJO_REGISTRY_PASSWORD" | docker login "$FORGEJO_REGISTRY_URL" --password-stdin -u "$FORGEJO_REGISTRY_USERNAME"
|
||||
- docker push "$REGISTRY_IMAGE_TAG"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
environment:
|
||||
FORGEJO_REGISTRY_URL:
|
||||
from_secret: FORGEJO_REGISTRY_URL
|
||||
|
@ -22,3 +13,25 @@ steps:
|
|||
from_secret: FORGEJO_REGISTRY_PASSWORD
|
||||
REGISTRY_IMAGE_TAG:
|
||||
from_secret: REGISTRY_IMAGE_TAG
|
||||
commands:
|
||||
- docker build -t "$REGISTRY_IMAGE_TAG" .
|
||||
- echo "$FORGEJO_REGISTRY_PASSWORD" | docker login "$FORGEJO_REGISTRY_URL" --password-stdin -u "$FORGEJO_REGISTRY_USERNAME"
|
||||
- docker push "$REGISTRY_IMAGE_TAG"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- name: discord
|
||||
image: appleboy/drone-discord
|
||||
settings:
|
||||
webhook_id:
|
||||
from_secret: DISCORD_WEBHOOK_ID
|
||||
webhook_token:
|
||||
from_secret: DISCORD_WEBHOOK_TOKEN
|
||||
message: >
|
||||
{{#success build.status}}
|
||||
{{repo.name}} build #{{build.number}} {{build.status}}
|
||||
{{/success}}
|
||||
depends_on: build
|
||||
|
||||
when:
|
||||
- branch: master
|
||||
event: push
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
steps:
|
||||
- name: deploy
|
||||
image: alpine:3.20
|
||||
when:
|
||||
- branch: master
|
||||
event: push
|
||||
environment:
|
||||
SSH_HOST:
|
||||
from_secret: SSH_HOST
|
||||
PROJECT_DIRECTORY:
|
||||
from_secret: PROJECT_DIRECTORY
|
||||
WOODPECKER_SSH_KEY:
|
||||
from_secret: WOODPECKER_SSH_KEY
|
||||
REGISTRY_IMAGE_TAG:
|
||||
from_secret: REGISTRY_IMAGE_TAG
|
||||
DOCKER_VOLUME_DB:
|
||||
from_secret: DOCKER_VOLUME_DB
|
||||
commands:
|
||||
- apk add openssh
|
||||
- mkdir -p /root/.ssh/
|
||||
|
@ -14,21 +22,26 @@ steps:
|
|||
cd "$PROJECT_DIRECTORY";
|
||||
docker-compose down;
|
||||
docker image rm "$REGISTRY_IMAGE_TAG" || true;
|
||||
docker volume rm "$DOCKER_DB_VOLUME" || true;
|
||||
docker volume rm "$DOCKER_VOLUME_DB" || true;
|
||||
docker pull "$REGISTRY_IMAGE_TAG";
|
||||
docker-compose up -d;
|
||||
docker image prune -af;"
|
||||
environment:
|
||||
SSH_HOST:
|
||||
from_secret: SSH_HOST
|
||||
PROJECT_DIRECTORY:
|
||||
from_secret: PROJECT_DIRECTORY
|
||||
WOODPECKER_SSH_KEY:
|
||||
from_secret: WOODPECKER_SSH_KEY
|
||||
REGISTRY_IMAGE_TAG:
|
||||
from_secret: REGISTRY_IMAGE_TAG
|
||||
DOCKER_DB_VOLUME:
|
||||
from_secret: DOCKER_DB_VOLUME
|
||||
- name: discord
|
||||
image: appleboy/drone-discord
|
||||
settings:
|
||||
webhook_id:
|
||||
from_secret: DISCORD_WEBHOOK_ID
|
||||
webhook_token:
|
||||
from_secret: DISCORD_WEBHOOK_TOKEN
|
||||
message: >
|
||||
{{#success build.status}}
|
||||
{{repo.name}} deployment #{{build.number}} {{build.status}}
|
||||
{{/success}}
|
||||
depends_on: deploy
|
||||
|
||||
when:
|
||||
- branch: master
|
||||
event: push
|
||||
|
||||
depends_on:
|
||||
- build
|
||||
|
|
Loading…
Add table
Reference in a new issue