Properly fix Dockerfile
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Lukáš Kucharczyk 2023-01-03 14:29:39 +01:00
parent b695a35fb1
commit eec8f1b9f5
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
2 changed files with 10 additions and 15 deletions

View File

@ -1,20 +1,15 @@
FROM python:3.10-slim-bullseye 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 ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv pip $VIRTUAL_ENV RUN python3 -m venv pip $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH" ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN pip install --no-cache-dir poetry RUN pip install --no-cache-dir poetry
RUN useradd --create-home --uid 1000 timetracker RUN useradd --create-home --uid 1000 timetracker
RUN git clone https://git.kucharczyk.xyz/lukas/timetracker.git /home/timetracker/app
WORKDIR /home/timetracker/app WORKDIR /home/timetracker/app
RUN chown -R timetracker /home/timetracker/app COPY . /home/timetracker/app/
RUN poetry install RUN chown -R timetracker:timetracker /home/timetracker/app
EXPOSE 8000 RUN poetry install --without dev
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
USER timetracker USER timetracker
COPY entrypoint.sh . EXPOSE 8000
ENTRYPOINT [ "entrypoint.sh" ] ENTRYPOINT [ "/entrypoint.sh" ]
# CMD [ "python3", "src/web/manage.py", "runserver", "0.0.0.0:8000" ]

View File

@ -1,8 +1,8 @@
#!/bin/env bash #!/bin/bash
# Apply database migrations # Apply database migrations
echo "Apply database migrations" echo "Apply database migrations"
python manage.py migrate python src/web/manage.py migrate
# Start server # Start server
echo "Starting server" echo "Starting server"
python manage.py runserver 0.0.0.0:8000 python src/web/manage.py runserver 0.0.0.0:8000