mirror of
https://codeberg.org/angestoepselt/homepage.git
synced 2025-05-24 14:46:16 +00:00
Add non-Nix Dockerfile
Tested using: podman build --build-arg SITE=angestoepselt . podman run -p 8123:80 -e ZAMMAD_TOKEN=1 -e HCAPTCHA_SITE_KEY=1 -e HCAPTCHA_SECRET_KEY=1 <the-image-that-was-just-built>
This commit is contained in:
parent
029d4c48c8
commit
158f1d32e9
4 changed files with 64 additions and 3 deletions
|
|
@ -19,7 +19,9 @@ function hyphenize(input) {
|
|||
module.exports = function (eleventyConfig) {
|
||||
const siteName = process.env.SITE;
|
||||
if (!siteName) {
|
||||
throw 'Cannot determine the name of the site to build. Make sure to set the SITE environment variable.';
|
||||
throw new Error(
|
||||
'Cannot determine the name of the site to build. Make sure to set the SITE environment variable.'
|
||||
);
|
||||
}
|
||||
|
||||
eleventyConfig.addPlugin(pluginRss);
|
||||
|
|
|
|||
59
Dockerfile
Normal file
59
Dockerfile
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
#
|
||||
# Static site build phase
|
||||
#
|
||||
FROM node:16 as build
|
||||
ARG SITE
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY package.json package-lock.json /build/
|
||||
RUN npm ci
|
||||
|
||||
COPY styles /build/styles/
|
||||
RUN npm run build:styles
|
||||
|
||||
COPY .eleventy* /build/
|
||||
COPY assets /build/assets/
|
||||
COPY includes /build/includes/
|
||||
COPY sites/${SITE} /build/sites/${SITE}/
|
||||
RUN SITE=${SITE} npm run build
|
||||
|
||||
|
||||
#
|
||||
# Actual server container
|
||||
#
|
||||
FROM python:3.10-alpine
|
||||
ARG SITE
|
||||
|
||||
# Install dependencies, see flake.nix for details.
|
||||
RUN apk add --no-cache lighttpd && \
|
||||
python -m pip install itsdangerous requests
|
||||
|
||||
COPY --from=build /build/dist /www/
|
||||
COPY cgi-bin /cgi-bin/
|
||||
COPY sites/${SITE}/httpd.conf /httpd.conf
|
||||
|
||||
# Patch the lighttpd config file. These placeholders expect a Nix derivation
|
||||
# path, so the Python binary used in the end is at @python@/bin/python. The
|
||||
# values here make sure they are found correctly in the non-Nix container,
|
||||
# even though the might not necessarily make sense directly.
|
||||
RUN sed -i \
|
||||
-e "s,@mimetypes@,/etc/lighttpd/mime-types.conf,g" \
|
||||
-e "s,@python@,/usr/local,g" \
|
||||
-e "s,@site@,/www,g" \
|
||||
-e "s,@cgibin@,/cgi-bin,g" \
|
||||
/httpd.conf
|
||||
|
||||
EXPOSE 80/tcp
|
||||
# Note: these are just those environment variables that have a default variable
|
||||
# and are optional, the non optional ones *will* need to be set by the user.
|
||||
ENV ZAMMAD_URL=https://ticket.z31.it
|
||||
ENV ZAMMAD_GROUP=""
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
|
||||
CMD curl --fail localhost || exit 1
|
||||
|
||||
# Reroute stdout to a new file descriptor so that Lighttpd can use it as the
|
||||
# access log. See http.conf and here:
|
||||
# https://redmine.lighttpd.net/boards/2/topics/8382
|
||||
ENTRYPOINT exec 3>&1 && /usr/sbin/lighttpd -Df /httpd.conf
|
||||
|
|
@ -42,9 +42,9 @@
|
|||
|
||||
lighttpdConfig = pkgs.substituteAll {
|
||||
src = ./sites/angestoepselt/httpd.conf;
|
||||
inherit (pkgs) lighttpd;
|
||||
inherit (packages) site;
|
||||
inherit python;
|
||||
mimetypes = "${pkgs.lighttpd}/share/lighttpd/doc/config/conf.d/mime.conf";
|
||||
cgibin = pkgs.copyPathToStore ./cgi-bin;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ server.port = 80
|
|||
# See here: https://redmine.lighttpd.net/boards/2/topics/8382
|
||||
accesslog.filename = "/dev/fd/3"
|
||||
|
||||
include "@lighttpd@/share/lighttpd/doc/config/conf.d/mime.conf"
|
||||
include "@mimetypes@"
|
||||
|
||||
server.document-root = "@site@"
|
||||
index-file.names = ( "index.html" )
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue