Browse Source
Co-authored-by: david <[email protected]> Reviewed-on: https://git.poyner.page/david/drcl/pulls/1 Co-authored-by: david <[email protected]> Co-committed-by: david <[email protected]>pull/3/head
david
2 years ago
10 changed files with 98 additions and 1 deletions
@ -0,0 +1,47 @@
|
||||
--- |
||||
kind: pipeline |
||||
name: default |
||||
|
||||
steps: |
||||
- name: build static files for storybook |
||||
image: node:16.13.1-alpine3.14 |
||||
commands: |
||||
- 'yarn install' |
||||
- 'yarn build-storybook' |
||||
|
||||
- name: build storybook image |
||||
image: plugins/docker |
||||
settings: |
||||
username: |
||||
from_secret: docker_username |
||||
password: |
||||
from_secret: docker_password |
||||
repo: daveplsno/storybook |
||||
tags: |
||||
- latest |
||||
- '${DRONE_COMMIT_SHA:0:8}' |
||||
|
||||
- name: deploy storybook to swarm |
||||
image: docker:dind |
||||
environment: |
||||
DEPLOY_ENV: |
||||
from_secret: DEPLOY_ENV |
||||
volumes: |
||||
- name: dockersock |
||||
path: /var/run/docker.sock |
||||
commands: |
||||
- export $DEPLOY_ENV |
||||
- export imageTag='${DRONE_COMMIT_SHA:0:8}' |
||||
- docker stack deploy -c ./swarm/docker-compose.storybook.yml storybook |
||||
- docker service update --force --update-parallelism 1 --update-delay 30s storybook_app |
||||
|
||||
volumes: |
||||
- name: dockersock |
||||
host: |
||||
path: /var/run/docker.sock |
||||
|
||||
trigger: |
||||
branch: |
||||
- master |
||||
event: |
||||
- push |
@ -0,0 +1,2 @@
|
||||
FROM nginx:alpine |
||||
COPY ./storybook-static /usr/share/nginx/html |
@ -0,0 +1,8 @@
|
||||
# export vars |
||||
export $(cat .env.deploy) |
||||
|
||||
# deploy to swarm |
||||
docker stack deploy -c ./docker-compose.storybook.yml --prune storybook |
||||
|
||||
# unset the env vars |
||||
unset $(cat .env.deploy | cut -f 1 -d '=' $1) |
@ -0,0 +1,28 @@
|
||||
--- |
||||
version: '3.8' |
||||
|
||||
networks: |
||||
swarmnet-public: |
||||
external: true |
||||
|
||||
services: |
||||
app: |
||||
image: daveplsno/storybook:${imageTag? Variable not set} |
||||
hostname: storybook |
||||
networks: |
||||
- swarmnet-public |
||||
deploy: |
||||
restart_policy: |
||||
condition: on-failure |
||||
placement: |
||||
constraints: |
||||
- node.labels.${storybookNode? Variable not set} == true |
||||
labels: |
||||
- traefik.enable=true |
||||
- traefik.docker.network=swarmnet-public |
||||
- traefik.constraint-label=swarmnet-public |
||||
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.rule=Host(`${storybookTraefikUrl? Variable not set}`) |
||||
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.entrypoints=websecure |
||||
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.tls=true |
||||
- traefik.http.routers.${storybookTraefikGrp? Variable not set}.tls.certresolver=le |
||||
- traefik.http.services.${storybookTraefikGrp? Variable not set}.loadbalancer.server.port=80 |
@ -0,0 +1,2 @@
|
||||
#!/bin/bash |
||||
docker service logs storybook_app -f |
@ -0,0 +1,3 @@
|
||||
#!/bin/bash |
||||
docker service scale storybook_app=0 |
||||
docker service scale storybook_app=1 |
Loading…
Reference in new issue