From 578c6eb525b9ea10b7713d13cdf707e946e3a6e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Fri, 29 Oct 2021 02:07:55 +0200 Subject: [PATCH] Fix Docker stuff --- .env.example | 1 + Dockerfile | 16 ++++++++++------ docker-compose.yml | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..279627a --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +DOMAIN=https://i.example.com/ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 81701a5..a04de67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,15 @@ RUN poetry export -f requirements.txt --output requirements.txt --without-hashes FROM python:3.9-slim +# TODO: Remove this +# We don't want apt-get to interact with us, +# and we want the default answers to be used for all questions. +ARG DEBIAN_FRONTEND=noninteractive + +# Update packages and install needed packages to build our requirements. +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential ffmpeg + # Create user so we don't run as root. RUN useradd --create-home botuser @@ -28,8 +37,6 @@ WORKDIR /home/botuser ENV PATH "$PATH:/home/botuser/.local/bin" -RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - - # Copy our Python application to our home directory. COPY --from=requirements-stage /tmp/requirements.txt /home/botuser/requirements.txt @@ -51,11 +58,8 @@ ENV PYTHONUNBUFFERED 1 # Use our virtual environment that we created in the other stage. ENV PATH="/opt/venv/bin:$PATH" -# Make the website accessible outside localhost -ENV FLASK_RUN_HOST=0.0.0.0 - # Expose the web port EXPOSE 5000 # Run bot. -CMD ["uvicorn", "main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"] +CMD ["uvicorn", "main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "5000"] diff --git a/docker-compose.yml b/docker-compose.yml index f2b3004..77767b0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,8 @@ services: discord-nice-embed-maker-for-my-yoy: image: thelovinator/discord-nice-embed-maker-for-my-yoy container_name: discord-nice-embed-maker-for-my-yoy + env_file: + - .env environment: - DOMAIN=${DOMAIN} ports: