From 34ed5b92221fef0141cdb9e59949d6aa156bb010 Mon Sep 17 00:00:00 2001 From: Gabriella Date: Fri, 21 Nov 2025 15:03:44 -0700 Subject: [PATCH] add missing prod files --- Dockerfile | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ compose.yaml | 5 +++++ requirements.txt | 31 ++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 Dockerfile create mode 100644 compose.yaml create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..112d438 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +# syntax=docker/dockerfile:1 + +# Comments are provided throughout this file to help you get started. +# If you need more help, visit the Dockerfile reference guide at +# https://docs.docker.com/go/dockerfile-reference/ + +# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7 + +ARG PYTHON_VERSION=3.11.5 +FROM python:${PYTHON_VERSION}-slim as base + +# Prevents Python from writing pyc files. +ENV PYTHONDONTWRITEBYTECODE=1 + +# Keeps Python from buffering stdout and stderr to avoid situations where +# the application crashes without emitting any logs due to buffering. +ENV PYTHONUNBUFFERED=1 + +# Set timezone in the container +ENV TZ="America/Detroit" + +WORKDIR /app + +# Create a non-privileged user that the app will run under. +# See https://docs.docker.com/go/dockerfile-user-best-practices/ +ARG UID=10001 +RUN adduser \ + --disabled-password \ + --gecos "" \ + --home "/nonexistent" \ + --shell "/sbin/nologin" \ + --no-create-home \ + --uid "${UID}" \ + appuser + +# Download dependencies as a separate step to take advantage of Docker's caching. +# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds. +# Leverage a bind mount to requirements.txt to avoid having to copy them into +# into this layer. +RUN --mount=type=cache,target=/root/.cache/pip \ + --mount=type=bind,source=requirements.txt,target=requirements.txt \ + python -m pip install -r requirements.txt + +# Switch to the non-privileged user to run the application. +USER appuser + +# Copy the source code into the container. +COPY . . + +# Expose the port that the application listens on. +EXPOSE 8000 + +CMD ["python3", "src/bot_core.py", "database.ini", "discord.token", "1128111628471255050", "1441504341797371996"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..eb954b8 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,5 @@ +services: + very-bad: + build: + context: . + dockerfile: Dockerfile \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..5dab640 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,31 @@ +aiohappyeyeballs==2.4.4 +aiohttp==3.11.11 +aiosignal==1.3.1 +astroid==3.2.4 +attrs==23.2.0 +Brotli==1.0.9 +certifi==2024.12.14 +charset-normalizer==2.0.4 +dill==0.3.8 +discord.py==2.4.0 +frozenlist==1.4.1 +idna==3.7 +iniconfig==2.0.0 +isort==5.13.2 +mccabe==0.7.0 +multidict==6.0.5 +packaging==24.1 +pip==23.3.1 +platformdirs==4.2.2 +pluggy==1.5.0 +propcache==0.2.1 +psycopg2-binary==2.9.9 +pylint==3.2.6 +PySocks==1.7.1 +pytest==8.2.2 +requests==2.32.5 +setuptools==80.9.0 +tomlkit==0.13.2 +urllib3==2.5.0 +wheel==0.41.2 +yarl==1.18.3