modifying container to run with low privilege user , updating alpine version ,updated django version

Signed-off-by: salecharohit <i@rohitsalecha.com>
This commit is contained in:
salecharohit 2021-08-03 22:25:37 +05:30
parent 4bbd137d73
commit 6243b83bbf
3 changed files with 12 additions and 10 deletions

View File

@ -27,10 +27,10 @@ services:
$ docker-compose up -d
Creating network "django_default" with the default driver
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
```
@ -49,4 +49,4 @@ After the application starts, navigate to `http://localhost:8000` in your web br
Stop and remove the containers
```
$ docker-compose down
```
```

View File

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

View File

@ -1,2 +1,2 @@
Django==3.0.14
Django==3.2.5
environs==7.3.1