use modern drone syntax, dronr-native hugo build, and better way to get signatures
parent
f728e46861
commit
fc1fd4e2c2
63
.drone.yml
63
.drone.yml
|
@ -1,27 +1,44 @@
|
||||||
pipeline:
|
---
|
||||||
syntaxcheck:
|
kind: pipeline
|
||||||
image: monachus/hugo:v0.70.0
|
name: default
|
||||||
commands:
|
|
||||||
- cd site; ./build/build.sh syntax
|
|
||||||
|
|
||||||
deploy:
|
steps:
|
||||||
image: tmaier/docker-compose
|
- name: copy-sigs
|
||||||
commands:
|
image: alpine:3
|
||||||
# Install git
|
commands:
|
||||||
- apk add -q git
|
- cp /tmp/signatures.json site/data/signatures/signatures.json
|
||||||
|
volumes:
|
||||||
|
- name: signatures
|
||||||
|
path: /tmp/signatures.json
|
||||||
|
|
||||||
# Clone the git remository
|
- name: hugo
|
||||||
# Make the signatures file available to the PMPC website
|
image: plugins/hugo
|
||||||
# Build the docker container
|
settings:
|
||||||
# Clean things up
|
source: site
|
||||||
- git clone https://git.fsfe.org/pmpc/website.git /tmp/pmpc-build && cd /tmp/pmpc-build/ && cp /tmp/signatures/signatures.json site/data/signatures/signatures.json && docker build -t pmpc .
|
validate: true
|
||||||
|
|
||||||
# Run docker compose
|
- name: deploy
|
||||||
- docker-compose up -d
|
image: docker/compose:1.24.0
|
||||||
volumes:
|
commands:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- docker-compose up --build -d
|
||||||
- /srv/forms/pmpc:/tmp/signatures:ro
|
volumes:
|
||||||
when:
|
- name: dockersock
|
||||||
event: [push, tag, deployment, cron]
|
path: /var/run/docker.sock
|
||||||
branch: master
|
when:
|
||||||
|
branch:
|
||||||
|
- master
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- tag
|
||||||
|
- deployment
|
||||||
|
- cron
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
host:
|
||||||
|
path: /var/run/docker.sock
|
||||||
|
- name: signatures
|
||||||
|
host:
|
||||||
|
path: /srv/forms/pmpc/signatures.json
|
||||||
|
|
||||||
|
...
|
||||||
|
|
|
@ -9,12 +9,12 @@
|
||||||
RedirectMatch permanent "^/zh_tw/?(.*)$" "/zh-tw/$1"
|
RedirectMatch permanent "^/zh_tw/?(.*)$" "/zh-tw/$1"
|
||||||
|
|
||||||
ServerAdmin contact@fsfe.org
|
ServerAdmin contact@fsfe.org
|
||||||
DocumentRoot /usr/share/blog/public/
|
DocumentRoot /var/www/html
|
||||||
|
|
||||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
|
||||||
<Directory /usr/share/blog/public/>
|
<Directory /var/www/html/>
|
||||||
Options FollowSymLinks Includes
|
Options FollowSymLinks Includes
|
||||||
AllowOverride All
|
AllowOverride All
|
||||||
Order allow,deny
|
Order allow,deny
|
||||||
|
|
24
Dockerfile
24
Dockerfile
|
@ -1,27 +1,9 @@
|
||||||
FROM php:7-apache
|
FROM php:7-apache
|
||||||
|
|
||||||
ENV HUGO_VERSION 0.70.0
|
COPY site/public/ /var/www/html
|
||||||
ENV HUGO_BINARY hugo_${HUGO_VERSION}_Linux-64bit.deb
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get upgrade -y && \
|
|
||||||
apt-get install -y git
|
|
||||||
|
|
||||||
RUN a2enmod rewrite
|
|
||||||
|
|
||||||
ADD https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_BINARY} /tmp/hugo.deb
|
|
||||||
RUN dpkg -i /tmp/hugo.deb && \
|
|
||||||
rm /tmp/hugo.deb
|
|
||||||
|
|
||||||
RUN mkdir -p /usr/share/blog
|
|
||||||
|
|
||||||
COPY . /tmp/pmpc-build/
|
|
||||||
|
|
||||||
WORKDIR /tmp/pmpc-build/site/
|
|
||||||
|
|
||||||
RUN build/build.sh && \
|
|
||||||
cp -r public/ /usr/share/blog/public/ && \
|
|
||||||
cd / && rm -rf /tmp/pmpc-build
|
|
||||||
|
|
||||||
COPY 000-default.conf /etc/apache2/sites-enabled/
|
COPY 000-default.conf /etc/apache2/sites-enabled/
|
||||||
|
|
||||||
|
RUN a2enmod rewrite
|
||||||
|
|
||||||
CMD apache2-foreground
|
CMD apache2-foreground
|
||||||
|
|
|
@ -1,22 +1,23 @@
|
||||||
version: '3'
|
version: '3'
|
||||||
services:
|
services:
|
||||||
|
|
||||||
pmpc:
|
pmpc:
|
||||||
image: pmpc
|
|
||||||
container_name: pmpc
|
container_name: pmpc
|
||||||
|
build: .
|
||||||
|
image: pmpc
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
|
||||||
- HUGO_BASE_URL=https://publiccode.eu/
|
|
||||||
- VIRTUAL_HOST=publiccode.eu,www.publiccode.eu
|
|
||||||
- LETSENCRYPT_HOST=publiccode.eu,www.publiccode.eu
|
|
||||||
- LETSENCRYPT_EMAIL=contact@fsfe.org
|
|
||||||
logging:
|
logging:
|
||||||
driver: json-file
|
driver: json-file
|
||||||
options:
|
options:
|
||||||
max-size: "5m"
|
max-size: "5m"
|
||||||
max-file: "5"
|
max-file: "5"
|
||||||
volumes:
|
environment:
|
||||||
- /srv/pmpc-cred:/srv/cred:ro
|
- VIRTUAL_HOST=publiccode.eu,www.publiccode.eu
|
||||||
|
- LETSENCRYPT_HOST=publiccode.eu,www.publiccode.eu
|
||||||
|
- LETSENCRYPT_EMAIL=contact@fsfe.org
|
||||||
|
|
||||||
|
# Connect the container which exposes the service to the 'bridge' network as
|
||||||
|
# this is where the reverse proxy is
|
||||||
connect-bridge:
|
connect-bridge:
|
||||||
image: docker:dind
|
image: docker:dind
|
||||||
volumes:
|
volumes:
|
||||||
|
|
Loading…
Reference in New Issue