Merge branch 'crashsystems-smaller_docker_image'
This commit is contained in:
commit
8906e0e7d8
4 changed files with 32 additions and 9 deletions
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
*.sqlite*
|
||||||
|
*.pyc
|
||||||
|
*local_settings.*
|
||||||
|
Dockerfile
|
||||||
|
README.md
|
||||||
|
LICENSE
|
31
Dockerfile
31
Dockerfile
|
@ -1,8 +1,25 @@
|
||||||
FROM ubuntu:latest
|
FROM python:3-alpine as builder
|
||||||
EXPOSE 8000
|
|
||||||
RUN apt-get update && apt-get upgrade -y && apt-get install -y python3 python3-pip
|
|
||||||
COPY . /home/python
|
|
||||||
WORKDIR /home/python
|
WORKDIR /home/python
|
||||||
RUN pip3 install -r requirements.txt
|
|
||||||
RUN python3 manage.py migrate
|
RUN apk add --no-cache zlib-dev build-base python-dev jpeg-dev
|
||||||
ENTRYPOINT python3 manage.py runserver 0.0.0.0:8000
|
RUN pip install virtualenv
|
||||||
|
RUN virtualenv venv
|
||||||
|
|
||||||
|
ADD requirements.txt /home/python/
|
||||||
|
RUN venv/bin/pip install --no-cache-dir -r requirements.txt
|
||||||
|
RUN virtualenv --relocatable venv/
|
||||||
|
|
||||||
|
ADD . /home/python/
|
||||||
|
RUN venv/bin/python manage.py migrate
|
||||||
|
|
||||||
|
FROM python:3-alpine
|
||||||
|
|
||||||
|
WORKDIR /home/python
|
||||||
|
COPY --from=builder /home/python /home/python
|
||||||
|
COPY --from=builder /lib /lib
|
||||||
|
COPY --from=builder /usr/lib /usr/lib
|
||||||
|
|
||||||
|
ENTRYPOINT ["venv/bin/python"]
|
||||||
|
ENV DJANGO_SETTINGS_MODULE=get_together.environ_settings
|
||||||
|
CMD ["manage.py", "runserver", "0.0.0.0:8000"]
|
||||||
|
|
|
@ -66,7 +66,7 @@ file):
|
||||||
### Using the docker container
|
### Using the docker container
|
||||||
```
|
```
|
||||||
docker build -t get_together .
|
docker build -t get_together .
|
||||||
docker run -d --name get_together -p 8000:8000 get_together
|
docker run -e "DEBUG_MODE=True" -e "SECRET_KEY=xxxxx" -e "ALLOWED_HOSTS=localhost,127.0.0.1" -d --name get_together -p 8000:8000 get_together
|
||||||
docker exec -it get_together python3 manage.py createsuperuser
|
docker exec -it get_together python3 manage.py createsuperuser
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ def home(request, *args, **kwards):
|
||||||
context['city_search'] = False
|
context['city_search'] = False
|
||||||
try:
|
try:
|
||||||
g = location.get_geoip(request)
|
g = location.get_geoip(request)
|
||||||
if g.latlng is not None and g.latlng[0] is not None and g.latlng[1] is not None:
|
if g.latlng is not None and len(g.latlng) >= 2 and g.latlng[0] is not None and g.latlng[1] is not None:
|
||||||
ll = g.latlng
|
ll = g.latlng
|
||||||
context['geoip_lookup'] = True
|
context['geoip_lookup'] = True
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue