From 73f77377cae1fc1a25ac80fe2ccfcb299c145d32 Mon Sep 17 00:00:00 2001 From: wurstsalat Date: Tue, 28 Sep 2021 23:46:39 +0200 Subject: [PATCH] Docker: Add development variant for local builds --- DockerfileDev | 32 ++++++++++++++++++++++++++++++++ Makefile | 8 +++++++- MakefileDocker | 6 +++--- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 DockerfileDev diff --git a/DockerfileDev b/DockerfileDev new file mode 100644 index 000000000..cbc3b3e6e --- /dev/null +++ b/DockerfileDev @@ -0,0 +1,32 @@ +# Dockerfile to build a docker image from XSF/xmpp.org Master for development purposes +# +# Dave Cridland +# Copyright 2017 Surevine Ltd + +# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +FROM debian:bullseye +MAINTAINER Dave Cridland + +# Set environment variables +ENV DEBIAN_FRONTEND noninteractive + +# Update system +RUN apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean + +# Install dependencies. +RUN apt-get install -y hugo python3 python3-pip && pip3 install requests + +# Build and copy in place. +WORKDIR /var/tmp/src/xmpp.org +COPY . /var/tmp/src/xmpp.org +RUN cd /var/tmp/src/xmpp.org && make prepare_docker + +FROM nginx +COPY deploy/xsf.conf /etc/nginx/conf.d/default.conf +COPY --from=0 /var/tmp/src/xmpp.org/public/ /var/www/html/ diff --git a/Makefile b/Makefile index 7ccdfb8bc..4a4c88ec8 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ help: @echo ' make clean remove the generated files ' @echo ' make publish generate using production settings ' @echo ' make serve serve site at http://localhost:1313' + @echo ' make prepare_docker prepare site for serving via docker' @echo ' make ssh_upload upload the web site via SSH ' @echo ' make rsync_upload upload the web site via rsync+ssh ' @echo ' make dropbox_upload upload the web site via Dropbox ' @@ -49,7 +50,12 @@ clean: serve: $(PY) $(TOOLSDIR)/prepare_xep_list.py $(HUGO) version - $(HUGO) server --bind=0.0.0.0 + $(HUGO) server --bind=0.0.0.0 --baseURL="http://localhost/" + +prepare_docker: + $(PY) $(TOOLSDIR)/prepare_xep_list.py + $(HUGO) version + $(HUGO) --baseURL="http://localhost/" publish: $(PY) $(TOOLSDIR)/prepare_xep_list.py diff --git a/MakefileDocker b/MakefileDocker index f3354a51c..a0d432e1f 100644 --- a/MakefileDocker +++ b/MakefileDocker @@ -1,9 +1,9 @@ # -# Build a docker image to build the website +# Build a docker image to build the website locally (for development) # all: - docker build -t xmpp-org/latest . + docker build -t xmpp-dockerdev -f ./DockerfileDev . serve: - docker run -p 80:80 -t -i xmpp-org/latest + docker run -p 80:80 -t -i xmpp-dockerdev