chore(): Building blog container for deployment
This commit is contained in:
parent
4a1580f113
commit
e28a8c9d35
3 changed files with 48 additions and 30 deletions
69
.drone.yml
69
.drone.yml
|
@ -6,44 +6,57 @@ clone:
|
||||||
depth: 1
|
depth: 1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: submodules
|
- name: update-submodules
|
||||||
image: alpine/git
|
image: alpine/git
|
||||||
commands:
|
commands:
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
|
|
||||||
- name: build
|
- name: generate-blog
|
||||||
image: plugins/hugo
|
image: plugins/hugo
|
||||||
settings:
|
settings:
|
||||||
hugo_version: 0.84.4
|
hugo_version: 0.84.4
|
||||||
validate: true
|
validate: true
|
||||||
pull: always
|
pull: always
|
||||||
|
|
||||||
- name: deploy
|
- name: clean-up-images
|
||||||
image: docker:dind
|
image: alpine
|
||||||
volumes:
|
|
||||||
- name: docker-socket
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
- name: blog-path
|
|
||||||
path: /blog/
|
|
||||||
environment:
|
|
||||||
UID:
|
|
||||||
from_secret: uid
|
|
||||||
GID:
|
|
||||||
from_secret: gid
|
|
||||||
commands:
|
commands:
|
||||||
- mv nginx/ public/
|
|
||||||
- rm -rf public/images/*
|
- rm -rf public/images/*
|
||||||
- chown -R "$UID":"$GID" public/
|
|
||||||
- mv public/ "/blog/${DRONE_COMMIT}"
|
|
||||||
- cd /blog/
|
|
||||||
- rm -f blog.lazkani.io
|
|
||||||
- ln -s "${DRONE_COMMIT}" blog.lazkani.io
|
|
||||||
- docker restart nginx
|
|
||||||
|
|
||||||
volumes:
|
- name: test-build-container
|
||||||
- name: docker-socket
|
image: plugins/docker
|
||||||
host:
|
settings:
|
||||||
path: /var/run/docker.sock
|
registry: scm.project42.io
|
||||||
- name: blog-path
|
username:
|
||||||
host:
|
from_secret: registry_username
|
||||||
path: /mnt/blog/
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
repo: scm.project42.io/elia/blog
|
||||||
|
dry_run: true
|
||||||
|
squash: true
|
||||||
|
tags:
|
||||||
|
- "${DRONE_COMMIT_SHA:0:8}"
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
exclude:
|
||||||
|
- tag
|
||||||
|
|
||||||
|
- name: build-container
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: scm.project42.io
|
||||||
|
username:
|
||||||
|
from_secret: registry_username
|
||||||
|
password:
|
||||||
|
from_secret: registry_password
|
||||||
|
repo: scm.project42.io/elia/blog
|
||||||
|
dry_run: false
|
||||||
|
squash: true
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- "${DRONE_COMMIT_SHA:0:8}"
|
||||||
|
when:
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- production
|
||||||
|
|
5
Dockerfile
Normal file
5
Dockerfile
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
FROM nginxinc/nginx-unprivileged:alpine
|
||||||
|
MAINTAINER Elia el Lazkani <elia@lazkani.io>
|
||||||
|
|
||||||
|
COPY public/ /usr/share/nginx/html/blog/
|
||||||
|
COPY nginx/default.conf.template /etc/nginx/templates/default.conf.template
|
|
@ -1,9 +1,9 @@
|
||||||
server {
|
server {
|
||||||
|
|
||||||
listen ${NGINX_BLOG_PORT};
|
listen ${NGINX_PORT};
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
root /usr/share/nginx/html/${NGINX_BLOG_HOST};
|
root /usr/share/nginx/html/blog;
|
||||||
|
|
||||||
error_page 404 /not-found/index.html;
|
error_page 404 /not-found/index.html;
|
||||||
error_page 403 /forbidden/index.html;
|
error_page 403 /forbidden/index.html;
|
||||||
|
|
Loading…
Reference in a new issue