-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (27 loc) · 1.22 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# syntax=docker/dockerfile:1
FROM python:3.10
ARG USERNAME=code
ARG USER_UID=1000
ARG USER_GID=$USER_UID
ENV PYTHONUNBUFFERED=1
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID --shell /bin/bash -m $USERNAME \
&& apt-get update \
&& apt-get --no-install-recommends install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& mkdir /data && chown $USER_UID:$USER_GID /data \
&& rm -rf /var/lib/apt/lists/
WORKDIR /code
# copy files required to build/install dependencies (this should cache the next `RUN` if none of the files was changed)
COPY Pipfile Pipfile.lock pyproject.toml README.md /code/
COPY firebase_push/__init__.py /code/firebase_push/
RUN --mount=type=cache,target=/root/.cache,sharing=locked,id=firebase-push-python \
python -m pip install pipenv && pipenv sync --system --dev && rm -rf ~/.local
# COPY . /code/
VOLUME /code
USER $USERNAME
# This starts only the web service, you'll need another instance which starts the celery worker
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
# To run the celery worker use this command:
# CMD ["celery", "--app", "demo", "worker"]