From 0058f8bb4c0f7cfc0cdf8baa6b901153e76ad246 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Fri, 15 Dec 2023 14:28:03 -0600 Subject: [PATCH] Add Containerfile --- .containerignore | 7 +++++++ Containerfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ httpd.conf | 11 +++++++++++ start.sh | 2 ++ 4 files changed, 70 insertions(+) create mode 100644 .containerignore create mode 100644 Containerfile create mode 100644 httpd.conf create mode 100755 start.sh diff --git a/.containerignore b/.containerignore new file mode 100644 index 0000000..32829be --- /dev/null +++ b/.containerignore @@ -0,0 +1,7 @@ +* +!src/ +!static/ +!MANIFEST.in +!setup.py +!start.sh +!httpd.conf diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..54b4bc4 --- /dev/null +++ b/Containerfile @@ -0,0 +1,50 @@ +FROM registry.fedoraproject.org/fedora-minimal:39 AS build + +RUN --mount=type=cache,target=/var/cache \ + microdnf install -y \ + --disablerepo=fedora-cisco-openh264 \ + --setopt=install_weak_deps=0 \ + python3-pip \ + python3-setuptools \ + python3-wheel \ + && : + +COPY . /build + +WORKDIR /build + +RUN python3 -m pip wheel -w dist . + +FROM registry.fedoraproject.org/fedora-minimal:39 + +RUN --mount=type=cache,target=/var/cache \ + --mount=type=bind,from=build,source=/build,target=/build \ + microdnf install -y \ + --disablerepo=fegora-cisco-openh264 \ + --setopt=install_weak_deps=0 \ + httpd \ + python3-setproctitle \ + python3-gunicorn \ + python3-pip \ + tini \ + && python3 -m pip install --no-index -f /build/dist DarkChestOfWonders \ + && install -o apache -g apache -d /data/screenshots /data/thumbnails \ + && chown apache: /var/log/httpd /var/run/httpd \ + && install /build/start.sh / \ + && sed -i \ + -e 's/Listen 80/Listen 8204/' \ + -e 's:logs/error_log:/dev/stderr:g' \ + -e 's:logs/access_log:/dev/stderr:g' \ + /etc/httpd/conf/httpd.conf \ + && cp /build/httpd.conf /etc/httpd/conf.d/ \ + && : + +EXPOSE 8204 + +USER apache + +VOLUME /data + +WORKDIR /data + +ENTRYPOINT ["tini", "/start.sh"] diff --git a/httpd.conf b/httpd.conf new file mode 100644 index 0000000..eb5343d --- /dev/null +++ b/httpd.conf @@ -0,0 +1,11 @@ +ServerName 127.0.0.1 + +Alias /screenshots /data/screenshots + + + Require all granted + + +ProxyPass /screenshots ! +ProxyPass / http://127.0.0.1:8000/ +ProxyPassReverse / http://127.0.:0.1:8000/ diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..28145c3 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +python3 -m gunicorn dcow.wsgi:application "$@" & +exec httpd -DFOREGROUND