aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml21
-rw-r--r--Dockerfile50
-rw-r--r--TODO.md1
-rw-r--r--docker-compose.yml73
4 files changed, 145 insertions, 0 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 766adfc..db45d7b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,9 @@ stages:
# Compilation procedure
- compile
+ # Deployment
+ - deploy
+
# Common variables
#variables:
# TAGGED_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
@@ -71,9 +74,27 @@ compile:
# Compile
- make
+ artifacts:
+ paths:
+ - build
+
+ rules:
+ - !reference [.default_rules, rules]
+
+pages:
+ # Use $LATEST_IMAGE when relying on the custom container image
+ #image: $LATEST_IMAGE
+ image: debian:bookworm
+
+ stage: deploy
+
+ script:
# Create the "public" artifact
- rsync -a ./build public/
+ dependencies:
+ - compile
+
artifacts:
paths:
- public
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..e206260
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,50 @@
+FROM debian:bookworm AS compiler
+MAINTAINER Silvio Rhatto <rhatto@riseup.net>
+
+COPY bin/provision /usr/local/bin
+COPY bin/provision.R /usr/local/bin
+
+RUN apt-get update && \
+ apt-get upgrade -y
+
+RUN /usr/local/bin/provision
+
+RUN apt-get install git -y
+
+RUN rm -rf /var/lib/apt/lists/*
+
+ARG CONTAINER_UID="${CONTAINER_UID:-1000}"
+ARG CONTAINER_GID="${CONTAINER_GID:-1000}"
+ARG APP="${APP:-compiler}"
+ENV APP_BASE="${APP_BASE:-/srv/shared}"
+
+RUN groupadd -r -g ${CONTAINER_GID} ${APP} && \
+ useradd --no-log-init -r -u ${CONTAINER_UID} -g ${APP} ${APP} && \
+ mkdir -p /home/${APP} && chown ${APP}. /home/${APP}
+
+RUN mkdir -p ${APP_BASE}
+
+RUN chown -R ${APP}.${APP} ${APP_BASE}
+
+USER ${APP}
+
+WORKDIR ${APP_BASE}
+
+FROM debian:bookworm AS site
+MAINTAINER Silvio Rhatto <rhatto@riseup.net>
+
+RUN apt-get update && \
+ apt-get upgrade -y
+
+COPY bin/provision-host /usr/local/bin
+
+RUN /usr/local/bin/provision-host
+
+RUN sed -i -e 's/<VirtualHost 127.0.0.1:80>/<VirtualHost *:80>/' /etc/apache2/sites-available/onion.conf
+
+FROM site AS tor
+
+RUN sed -i -e 's/RunAsDaemon 1/RunAsDaemon 0/' /etc/tor/torrc
+RUN sed -i -e 's/HiddenServicePort 80 127.0.0.1:80/HiddenServicePort 80 site:80/' /etc/tor/torrc
+
+USER debian-tor
diff --git a/TODO.md b/TODO.md
index a072728..093e115 100644
--- a/TODO.md
+++ b/TODO.md
@@ -16,6 +16,7 @@
## Improvements
* [ ] Localization:
+ * [ ] Make sure to properly localized the build date string.
* [ ] Setup a PO-file workflow for translating the structure and templates?
* [ ] Formats:
* [ ] Fix the EPUB output:
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..47a18c7
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,73 @@
+---
+# Needs a Docker Compose supporting the 3.4 version onwards, such as the one
+# from Debian bullseye-backports.
+version: '3.4'
+
+services:
+ compiler:
+ image: "bookup/compiler:0.0.1"
+
+ build:
+ context: .
+ target: compiler
+ dockerfile: Dockerfile
+ args:
+ - CONTAINER_UID=${CONTAINER_UID:-1000}
+ - CONTAINER_GID=${CONTAINER_GID:-1000}
+
+ volumes:
+ - .:/srv/shared
+
+ entrypoint: "make -C /srv/shared"
+
+ restart: "no"
+
+ tester:
+ image: "bookup/compiler:0.0.1"
+
+ build:
+ context: .
+ target: compiler
+ dockerfile: Dockerfile
+ args:
+ - CONTAINER_UID=${CONTAINER_UID:-1000}
+ - CONTAINER_GID=${CONTAINER_GID:-1000}
+
+ volumes:
+ - .:/srv/shared
+
+ entrypoint: "make -C /srv/shared tests"
+
+ restart: "no"
+
+ site:
+ image: "bookup/site:0.0.1"
+
+ build:
+ context: .
+ target: site
+ dockerfile: Dockerfile
+
+ volumes:
+ - .:/srv/shared
+
+ ports:
+ - 80:80
+
+ entrypoint: "apache2ctl -DFOREGROUND"
+
+ tor:
+ image: "bookup/tor:0.0.1"
+
+ build:
+ context: .
+ target: tor
+ dockerfile: Dockerfile
+
+ volumes:
+ - tor:/var/lib/tor
+
+ entrypoint: "/usr/bin/tor -f /etc/tor/torrc"
+
+volumes:
+ tor: {}