diff --git a/.drone.yml b/.drone.yml index 3f64448..2e0cf15 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,27 +1,44 @@ -pipeline: - syntaxcheck: - image: monachus/hugo:v0.70.0 - commands: - - cd site; ./build/build.sh syntax +--- +kind: pipeline +name: default - deploy: - image: tmaier/docker-compose - commands: - # Install git - - apk add -q git +steps: +- name: copy-sigs + image: alpine:3 + commands: + - cp /tmp/signatures.json site/data/signatures/signatures.json + volumes: + - name: signatures + path: /tmp/signatures.json - # Clone the git remository - # Make the signatures file available to the PMPC website - # Build the docker container - # Clean things up - - 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 . +- name: hugo + image: plugins/hugo + settings: + source: site + validate: true - # Run docker compose - - docker-compose up -d - volumes: - - /var/run/docker.sock:/var/run/docker.sock - - /srv/forms/pmpc:/tmp/signatures:ro - when: - event: [push, tag, deployment, cron] - branch: master +- name: deploy + image: docker/compose:1.24.0 + commands: + - docker-compose up --build -d + volumes: + - name: dockersock + path: /var/run/docker.sock + 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 + +... diff --git a/000-default.conf b/000-default.conf index 5935f58..b8bc11d 100644 --- a/000-default.conf +++ b/000-default.conf @@ -9,12 +9,12 @@ RedirectMatch permanent "^/zh_tw/?(.*)$" "/zh-tw/$1" ServerAdmin contact@fsfe.org - DocumentRoot /usr/share/blog/public/ + DocumentRoot /var/www/html ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined - + Options FollowSymLinks Includes AllowOverride All Order allow,deny diff --git a/Dockerfile b/Dockerfile index 61c5e48..3cb749c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,9 @@ FROM php:7-apache -ENV HUGO_VERSION 0.70.0 -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 site/public/ /var/www/html COPY 000-default.conf /etc/apache2/sites-enabled/ +RUN a2enmod rewrite + CMD apache2-foreground diff --git a/docker-compose.yml b/docker-compose.yml index d46e4d5..ec5c377 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,22 +1,23 @@ version: '3' services: + pmpc: - image: pmpc container_name: pmpc + build: . + image: pmpc 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: driver: json-file options: max-size: "5m" max-file: "5" - volumes: - - /srv/pmpc-cred:/srv/cred:ro + environment: + - 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: image: docker:dind volumes: