-
Notifications
You must be signed in to change notification settings - Fork 209
docs: Updated the Docker setup for portal #610
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
FROM python:2.7 | ||
# getting the base Image | ||
FROM python:3.6 | ||
|
||
MAINTAINER Ana Balica <[email protected]> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be better we have an official Email ID here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes so I can remove my email. |
||
|
||
# Updated by | ||
LABEL HUSSAIN="[email protected]" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure if this required, lots of people may commit on the Dockerfile in the future, we do not want to create unnecessary noise here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually used because in future some needs help in changing or understand the docker file. |
||
|
||
EXPOSE 8000 | ||
|
||
# Initializing the working directory | ||
WORKDIR /usr/src | ||
|
||
RUN mkdir portal | ||
|
||
RUN cd portal | ||
|
||
# Re-Initializing the working directory | ||
WORKDIR /usr/src/portal | ||
|
||
# Copy the requirement.txt for installing | ||
COPY requirements/prod.txt /usr/src/portal/requirements/prod.txt | ||
RUN pip install -r requirements/prod.txt | ||
COPY requirements/dev.txt /usr/src/portal/requirements/dev.txt | ||
|
||
# Installing the requirements | ||
RUN pip install -r requirements/dev.txt | ||
|
||
# Installing the GDAL Library | ||
# RUN apt-get install python-gdal | ||
RUN apt-get update | ||
RUN apt-get install -y software-properties-common | ||
RUN add-apt-repository ppa:ubuntugis/ppa | ||
RUN apt-get install -y gdal-bin python-gdal python3-gdal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes because while building it gives me an error regarding gdal lib not found during executing the cities_light command. So I tried to include and it resolved error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
are you sure about "python-gdal" as image using here is python3.6 , then why we need "python-gdal" library of python 2 . Also , installing "python-gdal" here will also install python2 and other dependency in the image . So, My suggestion is to only use "python3-gdal" here and verify for issue and also sure image size will further reduce. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
db: | ||
image: postgres:9.4 | ||
ports: | ||
- "5432:5432" | ||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
|
||
web: | ||
build: . | ||
command: python systers_portal/manage.py runserver 0.0.0.0:8000 | ||
volumes: | ||
- .:/usr/src/portal | ||
- .:/usr/src/portal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reasons for changing this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The extra space has actually no specific reason . I have just re-written the docker.yml so to maintain proper indentation I guess have added extra space. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally. indentation is done in multiples of 2, could you change this back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, sure I am actually not aware of indentation rule. |
||
ports: | ||
- "8000:8000" | ||
- "8000:8000" | ||
links: | ||
- db | ||
- db | ||
environment: | ||
- DJANGO_SETTINGS_MODULE=systers_portal.settings.docker | ||
|
||
- SECRET_KEY=foobarbaz | ||
- DJANGO_SETTINGS_MODULE=systers_portal.settings.docker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check what's the size of the resultant image? We may need to tinker with the base image to get the best results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the image size was 1.2GB with python 3.6 having 916MB. I just change the image version to keep update to date with the current documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try with
3.6-slim-buster
, that is the image I use, and as far as I know that's the image with the smallest footprintThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sure previously actually I used 3.6-slim and 3.6-alpine but it gave me error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that it reduced the size of the image to 600MB. I actually didn't use it first because the above-specified versions gave me an error that's why I keep as it is.