diff --git a/Dockerfile b/Dockerfile index 979702d..7b0de02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,15 @@ FROM python:3.10-slim-bullseye -RUN apt update \ - && apt install --no-install-recommends --yes \ - git \ - make \ - && rm -rf /var/lib/apt/lists/* ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv pip $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN pip install --no-cache-dir poetry RUN useradd --create-home --uid 1000 timetracker -RUN git clone https://git.kucharczyk.xyz/lukas/timetracker.git /home/timetracker/app WORKDIR /home/timetracker/app -RUN chown -R timetracker /home/timetracker/app -RUN poetry install -EXPOSE 8000 +COPY . /home/timetracker/app/ +RUN chown -R timetracker:timetracker /home/timetracker/app +RUN poetry install --without dev +COPY entrypoint.sh / +RUN chmod +x /entrypoint.sh USER timetracker -COPY entrypoint.sh . -ENTRYPOINT [ "entrypoint.sh" ] -# CMD [ "python3", "src/web/manage.py", "runserver", "0.0.0.0:8000" ] \ No newline at end of file +EXPOSE 8000 +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index 5ea3aa9..66f5cb2 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,8 +1,8 @@ -#!/bin/env bash +#!/bin/bash # Apply database migrations echo "Apply database migrations" -python manage.py migrate +python src/web/manage.py migrate # Start server echo "Starting server" -python manage.py runserver 0.0.0.0:8000 \ No newline at end of file +python src/web/manage.py runserver 0.0.0.0:8000 \ No newline at end of file