Add poetry.lock

Update pyproject.toml
update dockerfile
This commit is contained in:
2026-02-19 21:49:28 -07:00
parent 134bafdc61
commit 95e2ddf103
3 changed files with 1128 additions and 21 deletions

View File

@@ -7,7 +7,7 @@
# 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
FROM ubuntu:latest AS base
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
@@ -23,31 +23,52 @@ 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
# ARG UID=10001
# RUN useradd 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
# update package list
RUN apt-get update
# Switch to the non-privileged user to run the application.
USER appuser
# install wget
# install python, pipx
RUN apt-get install -y wget python3 pipx
# install latest conda
# ENV PATH="/root/miniconda3/bin:${PATH}"
# ARG PATH="/root/miniconda3/bin:${PATH}"
# RUN arch=$(uname -m) && \
# if [ "$arch" = "x86_64" ]; then \
# MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh"; \
# elif [ "$arch" = "aarch64" ]; then \
# MINICONDA_URL="https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-aarch64.sh"; \
# else \
# echo "Unsupported architecture: $arch"; \
# exit 1; \
# fi && \
# wget $MINICONDA_URL -O miniconda.sh && \
# mkdir -p /root/.conda && \
# bash miniconda.sh -b -p /root/miniconda3 && \
# rm -f miniconda.sh
# Copy the source code into the container.
COPY . .
# RUN conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
# conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
# RUN conda env create -f ./environment.yml
# SHELL ["conda", "run", "-n", "very-bad", "/bin/bash", "-c"]
# Switch to the non-privileged user to run the application.
# install poetry via pipx
RUN pipx install poetry && pipx ensurepath
RUN ~/.local/bin/poetry install
# Expose the port that the application listens on.
EXPOSE 8000
CMD ["python3", "src/bot_core.py", "database.ini", "discord.token", "1128111628471255050", "1441504341797371996"]
CMD ~/.local/bin/poetry run python src/bot_core.py database.ini discord.token 1128111628471255050 1441504341797371996