-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Dockerfile_prod #64
Conversation
Added a Dockerfile which: - Uses python:3.9 as base image - Installs the PVOutput lib with pip - Launches a Jupyter notebook server with the example code
for more information, see https://pre-commit.ci
@JackKelly or @peterdudfield, please could you review this and if happy, add the production image to a Docker repo (Docker Hub maybe?). Then I'll update the README with usage instructions. I suggest tagging this build as |
Dockerfile_prod
Outdated
@@ -0,0 +1,11 @@ | |||
FROM python:3.9 |
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.
NIT: By any chance: Did u try the -slim
variant of the image?
It's only ~45MB instead of ~330MB and I generally prefer those to make things smaller and faster.
Should just work out of the box, but sometimes it doesn't.
FROM python:3.9 | |
FROM python:3.9-slim |
Its it worth putting this in a folder called 'infrastructure/docker' as there will be another (the dev one) docker file soon |
Here's some code, but we probably need to add some 'key' to this repo |
@JamieTaylor-TUOS shall i do this, and push to this branch? |
Ive added issue #76 for pushing the docker file to dockerhub |
Added a Dockerfile which:
Pull Request
Description
This Docker image is useful as a playground and for working interactively with the PVOuput library via Jupyter.
Fixes #63
How Has This Been Tested?
I have built locally as:
And then tested locally:
>> docker run -it --rm -p 1234:1234 -v .pvoutput.yml:/.pvoutput.yml -e PVOUTPUT_CONFIG=/.pvoutput.yml sheffieldsolar/pvoutput:prod-20211118
This successfully launches a Jupyter notebook which can be accessed from the host machine at http://127.0.0.1:1234.
From there, one can edit and run the code in the examples, or create new notebooks.
Note that the config file is being mounted at runtime to
/.pvoutput.yml
and the env varPVOUTPUT_CONFIG
is being set to point to this location. In production, the config file could be added as a secret, in which case the-v
flag can be dropped and thePVOUTPUT_CONFIG
env var updated to point to the secret.Note also, that in order to extract data to the host machine or work with persistent notebook files, it would be necessary for the user to also mount a local host directory where notebooks / data can be saved, using either a bind mount or a volume mount. Alternatively, data could be extracted via the internet (e.g. Google Drive).
I have not updated the README to document this Docker image, as I thought it important to have a hosting solution for the image first, so that users are not required to build locally.
Checklist: