Compare commits

..

4 Commits

Author SHA1 Message Date
Dustin 0058f8bb4c Add Containerfile
dustin/dcow-site/pipeline/head There was a failure building this commit Details
2023-12-15 14:28:03 -06:00
Dustin 06ef3d4146 wsgi: Add basic WSGI module 2023-12-15 14:27:39 -06:00
Dustin 810f7d07b8 base: Set response charset
WebOb has started raising an exception when writing a Unicode string to
`Response` objects if no charset is set.
2023-12-15 14:26:53 -06:00
Dustin 9023294c60 Version 5 2023-12-15 14:26:21 -06:00
7 changed files with 80 additions and 1 deletions

7
.containerignore Normal file
View File

@ -0,0 +1,7 @@
*
!src/
!static/
!MANIFEST.in
!setup.py
!start.sh
!httpd.conf

50
Containerfile Normal file
View File

@ -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"]

11
httpd.conf Normal file
View File

@ -0,0 +1,11 @@
ServerName 127.0.0.1
Alias /screenshots /data/screenshots
<Directory /data/screenshots>
Require all granted
</Directory>
ProxyPass /screenshots !
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.:0.1:8000/

View File

@ -2,7 +2,7 @@ from setuptools import find_packages, setup
setup(
name='DarkChestOfWonders',
version='4',
version='5',
description='Dark Chest of Wonders Guild Site',
author='Gyrfalcon',
author_email='gyrfalcon@darkchestofwonders.us',

View File

@ -30,10 +30,12 @@ class VariedResponse(milla.Response):
context = {}
if template is None or self.request.want == 'json':
self.content_type = str('application/json')
self.charset = 'utf-8'
json.dump(context, self.body_file)
else:
if self.request.want == 'xhtml':
self.content_type = str('application/xhtml+xml')
self.charset = 'utf-8'
self.render(template, context)
def render(self, template, context=None):

7
src/dcow/wsgi.py Normal file
View File

@ -0,0 +1,7 @@
import os
import dcow.app
config = os.environ.get('DCOW_CONFIG', 'production.ini')
application = dcow.app.Application.create(config)

2
start.sh Executable file
View File

@ -0,0 +1,2 @@
python3 -m gunicorn dcow.wsgi:application "$@" &
exec httpd -DFOREGROUND