Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions labs/lab18/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
app_python/result
app_python/result-*
app_python/venv*/
app_python/freeze*.txt
app_python/requirements-unpinned.txt
*.tar
*.tar.gz
27 changes: 27 additions & 0 deletions labs/lab18/app_python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM python:3.12-slim
WORKDIR /app_python
COPY requirements.txt .

# Installs newest packet versions(or reloads indices) without additional recomendations,
# clears cache from installation,
# creates non-root user,
# and installs python requirements
RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/* \
&& useradd --create-home --shell /bin/bash appuser \
&& mkdir -p /data /config \
&& chown -R appuser:appuser /data /config \
&& pip install --no-cache-dir -r requirements.txt

COPY app.py .
#COPY templates/ templates/
# There are no /templates now...

ENV VISITS_FILE=/data/visits
ENV CONFIG_FILE=/config/config.json

EXPOSE 5000

USER appuser

CMD ["python", "app.py"]
Loading