-
-
Notifications
You must be signed in to change notification settings - Fork 37
Add docker image #81
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
base: master
Are you sure you want to change the base?
Add docker image #81
Changes from all commits
435eb16
5f766b9
a163d75
b32a8fb
00b6247
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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ARG BASE_IMAGE=python:${PYTHON_VERSION} | ||
|
|
||
| FROM ${BASE_IMAGE} as base | ||
|
|
||
| RUN apt-get update \ | ||
| && apt-get install --no-install-recommends -y cmake \ | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /nlp_profiler | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN pip install --no-cache-dir -r requirements-dev.txt \ | ||
| && pip install --no-cache-dir -r requirements.txt \ | ||
| && pip install --no-cache-dir -r requirements-nix-dev.txt | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #!/bin/bash | ||
|
Owner
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. Try to get familiar with a bash shell linter to see what comments it has about your shell script - search for Use the comments from |
||
|
|
||
| set -e | ||
| set -u | ||
| set -o pipefail | ||
|
|
||
| PYTHON_VERSION=${1:-"3.8"} | ||
|
|
||
| MOUNT_VOLUME="${PWD}/../" | ||
| TARGET_FOLDER="/nlp_profiler" | ||
| DOCKER_IMAGE_NAME="nlp_profiler" | ||
|
|
||
| echo "~~~ Running nlp_profiler in a docker container" | ||
| echo "Docker image name: ${DOCKER_IMAGE_NAME}" | ||
| echo "Mounted volume: ${MOUNT_VOLUME}" | ||
| echo "Target folder: ${TARGET_FOLDER}" | ||
|
|
||
|
Owner
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. Its a good practise to |
||
| echo "~~~ Building docker image ${DOCKER_IMAGE_NAME} with Python version ${PYTHON_VERSION}." | ||
| docker build -t ${DOCKER_IMAGE_NAME} --build-arg python_version="${PYTHON_VERSION}" ../ | ||
|
|
||
|
Owner
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's a good practice to show this line executing with all its parameters, how would you do that in bash? Also look at one of the examples from the resources shared above |
||
| echo "~~~ Running docker container ${DOCKER_IMAGE_NAME}." | ||
| docker run -it \ | ||
| --volume "${MOUNT_VOLUME}":${TARGET_FOLDER} \ | ||
| --workdir ${TARGET_FOLDER} \ | ||
| ${DOCKER_IMAGE_NAME} \ | ||
| /bin/bash | ||
|
|
||
| echo "~~~ Exited docker container." | ||
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.
Try to get familiar with
hadolintand apply it to yourDockerfileto see what suggestions it gives you in terms of improving the code, here's a post to learn more about itThere 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.
I've used hadolint to format the Dockerfile accordingly :)