1 | FROM python:3.7-slim-buster
|
---|
2 |
|
---|
3 | ENV PYTHONUNBUFFERED 1
|
---|
4 |
|
---|
5 | RUN mkdir /code
|
---|
6 |
|
---|
7 | RUN addgroup --system --gid 1001 non-root && adduser --system non-root --gid 1001 --uid 1001 && chown -R non-root:non-root /code
|
---|
8 |
|
---|
9 | RUN apt-get update \
|
---|
10 | && apt-get install -y gcc \
|
---|
11 | && pip install --no-cache-dir Django pywatchman\
|
---|
12 | && apt-get purge -y gcc \
|
---|
13 | && apt-get autoremove -y \
|
---|
14 | && apt-get clean
|
---|
15 |
|
---|
16 | # Install watchman
|
---|
17 | RUN apt-get install -y wget unzip \
|
---|
18 | && wget https://github.com/facebook/watchman/releases/download/v2020.08.17.00/watchman-v2020.08.17.00-linux.zip \
|
---|
19 | && unzip watchman-*-linux.zip \
|
---|
20 | && mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman \
|
---|
21 | && cp watchman-*-linux/bin/* /usr/local/bin \
|
---|
22 | && cp watchman-*-linux/lib/* /usr/local/lib \
|
---|
23 | && chmod 755 /usr/local/bin/watchman \
|
---|
24 | && chmod 2777 /usr/local/var/run/watchman \
|
---|
25 | && rm -rf watchman-*-linux watchman-*-linux.zip \
|
---|
26 | && apt-get purge -y wget unzip \
|
---|
27 | && apt-get autoremove -y \
|
---|
28 | && apt-get clean
|
---|
29 |
|
---|
30 | USER non-root
|
---|
31 |
|
---|
32 | WORKDIR /code
|
---|
33 |
|
---|
34 | RUN django-admin startproject debug_watchman
|
---|
35 |
|
---|
36 | WORKDIR /code/debug_watchman
|
---|
37 |
|
---|
38 | RUN echo "import os" >> debug_watchman/settings.py
|
---|
39 | RUN echo "LOGGING = {'version': 1, 'disable_existing_loggers': False, 'handlers': {'console': {'class': 'logging.StreamHandler'}}, 'loggers': {'django': {'handlers': ['console'], 'level': 'DEBUG'}}} if os.environ.get('LOG', None) else {}" >> debug_watchman/settings.py
|
---|
40 |
|
---|
41 | CMD ["python", "manage.py","runserver", "0.0.0.0:8000"]
|
---|