Compare commits
2 Commits
dd957c829b
...
7a83da1aff
Author | SHA1 | Date |
---|---|---|
FyloZ | 7a83da1aff | |
FyloZ | 235a46816c |
|
@ -0,0 +1,2 @@
|
|||
Dockerfile
|
||||
docker-compose.yml
|
|
@ -0,0 +1,72 @@
|
|||
---
|
||||
global-variables:
|
||||
environment: &environment
|
||||
CRE_PORT: 9103
|
||||
CRE_RELEASE: ${DRONE_BRANCH##**/}
|
||||
alpine-image: &alpine-image alpine:latest
|
||||
docker-registry-repo: &docker-registry-repo registry.fyloz.dev:5443/colorrecipesexplorer/docs
|
||||
|
||||
kind: pipeline
|
||||
name: build
|
||||
type: docker
|
||||
|
||||
steps:
|
||||
- name: set-docker-tags-latest
|
||||
image: *alpine-image
|
||||
commands:
|
||||
- echo -n "latest" > .tags
|
||||
when:
|
||||
branch: master
|
||||
|
||||
- name: set-docker-tags-release
|
||||
image: *alpine-image
|
||||
environment:
|
||||
<<: *environment
|
||||
commands:
|
||||
- echo -n "latest-release,$CRE_RELEASE" > .tags
|
||||
when:
|
||||
branch: release/**
|
||||
|
||||
- name: containerize
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: *docker-registry-repo
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
- release/**
|
||||
|
||||
- name: deploy
|
||||
image: *alpine-image
|
||||
environment:
|
||||
<<: *environment
|
||||
CRE_REGISTRY_IMAGE: *docker-registry-repo
|
||||
DEPLOY_SERVER:
|
||||
from_secret: deploy_server
|
||||
DEPLOY_SERVER_USERNAME:
|
||||
from_secret: deploy_server_username
|
||||
DEPLOY_SERVER_SSH_PORT:
|
||||
from_secret: deploy_server_ssh_port
|
||||
DEPLOY_SERVER_SSH_KEY:
|
||||
from_secret: deploy_server_ssh_key
|
||||
DEPLOY_CONTAINER_NAME: cre_docs
|
||||
commands:
|
||||
- apk update
|
||||
- apk add --no-cache openssh-client
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$DEPLOY_SERVER_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa
|
||||
- chmod 700 ~/.ssh/id_rsa
|
||||
- eval $(ssh-agent -s)
|
||||
- ssh-add ~/.ssh/id_rsa
|
||||
- ssh-keyscan -p $DEPLOY_SERVER_SSH_PORT -H $DEPLOY_SERVER >> ~/.ssh/known_hosts
|
||||
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
|
||||
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker stop $DEPLOY_CONTAINER_NAME || true && docker rm $DEPLOY_CONTAINER_NAME || true"
|
||||
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker pull $CRE_REGISTRY_IMAGE:$CRE_RELEASE"
|
||||
- ssh -p $DEPLOY_SERVER_SSH_PORT $DEPLOY_SERVER_USERNAME@$DEPLOY_SERVER "docker run -d -p $CRE_PORT:80 --name=$DEPLOY_CONTAINER_NAME $CRE_REGISTRY_IMAGE:$CRE_RELEASE"
|
||||
when:
|
||||
branch: release/**
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
- release/**
|
|
@ -0,0 +1,26 @@
|
|||
ARG ALPINE_VERSION=3.14
|
||||
|
||||
FROM alpine:$ALPINE_VERSION AS build
|
||||
WORKDIR /usr/src
|
||||
|
||||
ARG ALPINE_VERSION
|
||||
|
||||
RUN apk update
|
||||
RUN apk add --no-cache py-pip
|
||||
RUN pip install mkdocs mkdocs-material
|
||||
|
||||
COPY mkdocs.yml .
|
||||
COPY docs docs
|
||||
|
||||
RUN mkdocs build
|
||||
|
||||
|
||||
FROM nginx:mainline-alpine
|
||||
WORKDIR /usr/bin/
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --from=build /usr/src/site/ .
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -0,0 +1,17 @@
|
|||
worker_processes 4;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/bin;
|
||||
include /etc/nginx/mime.types;
|
||||
|
||||
# location / {
|
||||
# try_files $uri /index.html =404;
|
||||
# }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue