- modifying container to run with low privilege user

- updating alpine version
- updated readme
This commit is contained in:
salecharohit 2021-08-03 21:36:56 +05:30
parent 4bbd137d73
commit 6062d339cf
2 changed files with 9 additions and 7 deletions

View File

@ -27,10 +27,10 @@ services:
$ docker-compose up -d $ docker-compose up -d
Creating network "django_default" with the default driver Creating network "django_default" with the default driver
Building web Building web
Step 1/6 : FROM python:3.7-alpine Step 1/6 : FROM python:alpine3.14
... ...
... ...
Status: Downloaded newer image for python:3.7-alpine Status: Downloaded newer image for python:alpine3.14
Creating django_web_1 ... done Creating django_web_1 ... done
``` ```

View File

@ -1,8 +1,10 @@
FROM python:3.7-alpine FROM python:alpine3.14
EXPOSE 8000 RUN addgroup django && adduser -D -h /home/django -s /bin/ash django -G django
WORKDIR /app WORKDIR /home/django
COPY requirements.txt /app USER django
COPY requirements.txt /home/django
RUN pip3 install -r requirements.txt --no-cache-dir RUN pip3 install -r requirements.txt --no-cache-dir
COPY . /app COPY . /home/django
EXPOSE 8000
ENTRYPOINT ["python3"] ENTRYPOINT ["python3"]
CMD ["manage.py", "runserver", "0.0.0.0:8000"] CMD ["manage.py", "runserver", "0.0.0.0:8000"]