-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM debian:bullseye AS base | ||
|
||
ARG BACKEND_PATH=./MafiAStarLite | ||
|
||
# Install normal dependencies | ||
RUN apt-get update | ||
RUN apt-get -y --no-install-recommends install uwsgi uwsgi-plugin-python3 python3 python3-pip python3-setuptools pipenv nginx | ||
RUN pip3 install wheel | ||
|
||
# Add project code to container | ||
ADD $BACKEND_PATH /app/backend | ||
|
||
# Setup backend | ||
RUN cd /app/backend && pipenv install --system --deploy --ignore-pipfile | ||
|
||
FROM node:18 AS frontend | ||
|
||
# Build frontend | ||
ARG FRONTEND_PATH=./MafiAStarLite-frontend | ||
ADD $FRONTEND_PATH /app/frontend | ||
WORKDIR /app/frontend | ||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM base AS final | ||
COPY --from=frontend /app/frontend/dist /app/static | ||
RUN mkdir /app/backend/logs | ||
ADD start.sh /usr/local/bin/run | ||
ADD uwsgi-mafiastar.ini /etc/uwsgi/mafiastar.ini | ||
ADD nginx.conf /etc/nginx/sites-enabled/default | ||
|
||
RUN usermod -u 2009 -g 33 -d /app/backend www-data | ||
|
||
CMD /usr/local/bin/run |
Submodule MafiAStarLite
added at
37bcfe
Submodule MafiAStarLite-frontend
added at
a916f0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# vim: set filetype=conf: | ||
|
||
server { | ||
listen 80; | ||
server_name default_server; | ||
|
||
try_files $uri /index.html; | ||
root /app/static; | ||
|
||
location /admin { | ||
include uwsgi_params; | ||
uwsgi_pass 127.0.0.1:3008; | ||
} | ||
|
||
location /api { | ||
include uwsgi_params; | ||
uwsgi_pass 127.0.0.1:3008; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -e | ||
export USER=www-data | ||
export HOME=/home/www-data | ||
|
||
# Migrate database and deploy staticfiles | ||
python3 /app/backend/manage.py migrate | ||
python3 /app/backend/manage.py collectstatic --noinput | ||
chown -R www-data:www-data /app/backend/logs | ||
|
||
# Start backend with uWSGI | ||
nginx | ||
exec uwsgi /etc/uwsgi/mafiastar.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[uwsgi] | ||
|
||
procname-master = uwsgi %n | ||
master = true | ||
socket = :3008 | ||
|
||
plugins = python3 | ||
|
||
chdir = /app/backend | ||
|
||
#home = /opt/tauschen/tauschen-backend/.pyenv | ||
module = MafiAStarLite.wsgi:application | ||
#env = DJANGO_SETTINGS_MODULE=tauschen.settings | ||
env = LANG='C.UTF-8' | ||
env = LC_ALL='C.UTF-8' | ||
|
||
; drop privileges | ||
uid = www-data | ||
gid = www-data | ||
umask = 027 | ||
|
||
; run with at least 2 process but increase up to 8 when needed | ||
processes = 8 | ||
cheaper = 2 | ||
|
||
; reload whenever this config file changes | ||
; %p is the full path of the current config file | ||
touch-reload = %p | ||
|
||
; disable uWSGI request logging | ||
disable-logging = true | ||
|
||
enable-threads = true | ||
|
||
; cron job | ||
cron2 = minute=30,hour=2,unique=1 python3 /app/backend/manage.py updatedb |