feat(docker): Updated Docker configuration for improved security and build efficiency

- Removed sensitive files from .dockerignore
- Moved WORKDIR to /app in Dockerfile
- Added gunicorn==23.0.0 dependency in RUN command
- Created new docker-compose.yml file for service definition
This commit is contained in:
Adrian Priestley
2024-12-28 18:19:02 -03:30
committed by Adrian Priestley
parent 62a33b0022
commit 2af68c57a4
3 changed files with 228 additions and 3 deletions

View File

@@ -5,3 +5,206 @@ docs
test
typings
*Client.py
.idea
.vscode
*_Spoiler.txt
*.bmbp
*.apbp
*.apl2ac
*.apm3
*.apmc
*.apz5
*.aptloz
*.apemerald
*.pyc
*.pyd
*.sfc
*.z64
*.n64
*.nes
*.smc
*.sms
*.gb
*.gbc
*.gba
*.wixobj
*.lck
*.db3
*multidata
*multisave
*.archipelago
*.apsave
*.BIN
*.puml
setups
build
bundle/components.wxs
dist
/prof/
README.html
.vs/
EnemizerCLI/
/Players/
/SNI/
/sni-*/
/appimagetool*
/host.yaml
/options.yaml
/config.yaml
/logs/
_persistent_storage.yaml
mystery_result_*.yaml
*-errors.txt
success.txt
output/
Output Logs/
/factorio/
/Minecraft Forge Server/
/WebHostLib/static/generated
/freeze_requirements.txt
/Archipelago.zip
/setup.ini
/installdelete.iss
/data/user.kv
/datapackage
/custom_worlds
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
*.dll
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
installer.log
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# vim editor
*.swp
# SageMath parsed files
*.sage.py
# Environments
.env
.venv*
env/
venv/
/venv*/
ENV/
env.bak/
venv.bak/
*.code-workspace
shell.nix
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# Cython intermediates
_speedups.c
_speedups.cpp
_speedups.html
# minecraft server stuff
jdk*/
minecraft*/
minecraft_versions.json
!worlds/minecraft/
# pyenv
.python-version
#undertale stuff
/Undertale/
# OS General Files
.DS_Store
.AppleDouble
.LSOverride
Thumbs.db
[Dd]esktop.ini

View File

@@ -22,7 +22,7 @@ RUN if [ "$ARCHITECTURE" = "x86_64" ]; then \
#Archipelago
FROM python:3.12-slim AS archipelago
ENV VIRTUAL_ENV=/opt/venv
WORKDIR /run
WORKDIR /app
COPY . .
#install requirements
@@ -41,7 +41,7 @@ RUN python -m venv $VIRTUAL_ENV; \
. $VIRTUAL_ENV/bin/activate
#hadolint ignore=DL3042
RUN pip install -r WebHostLib/requirements.txt; \
RUN pip install -r WebHostLib/requirements.txt gunicorn==23.0.0; \
python ModuleUpdate.py -y
RUN cythonize -i _speedups.pyx
@@ -63,4 +63,4 @@ RUN if [ "$ARCHITECTURE" = "x86_64" ]; then \
fi; \
rm -rf /tmp/EnemizerCLI
CMD ["python", "WebHost.py"]
ENTRYPOINT [ "python", "WebHost.py" ]

22
docker-compose.yml Normal file
View File

@@ -0,0 +1,22 @@
services:
web:
build:
context: .
command: python WebHost.py
volumes:
- static_volume:/app/WebHostLib
- ./config.yaml:/app/config.yaml
expose:
- 5000
nginx:
image: nginx:stable-alpine
volumes:
- static_volume:/app/WebHostLib
- ./nginx.conf:/etc/nginx/conf.d/default.conf
ports:
- 7235:80
depends_on:
- web
volumes:
static_volume: