christophetd/docker-python-sandbox

Add a section to the FAQ explaining how to add stuff to the docker image

christophetd opened this issue · 2 comments

Add a section to the FAQ explaining how to add stuff to the docker image

To add anything to the docker image Modify the DockerFile (docker-python-sandbox/container/DockerFile).

You can add any installation commands you require. (for example below I have added python3 to the container)

FROM node:argon

RUN ["adduser",  "--home",  "/usr/src/app", "--system", "sandboxuser"]
RUN ["chown", "-R", "sandboxuser", "/usr/src/app"]
RUN ["chmod", "-R", "u+rwx", "/usr/src/app"]

COPY ./shared /usr/src/app
RUN cd /usr/src/app && npm install

COPY start.sh /
RUN chmod 755 /start.sh

RUN apt-get update

# Install python3
RUN apt-get install python3 -y

CMD ["/start.sh"]

You can also add files and folders in the docker file which can be then utalised after the containers instantiation from the start.sh file, this for example, is how the node server is started.

Then run the ./build.sh command from the "docker-python-sandbox/container/" directory. This will rebuild the "christophetd/docker_sandbox" image. However, if you wish to maintain the functionality of the previous image you can specify a new image name in the build.sh file as seen below:

#!/bin/bash

# Enter your image name below.
IMAGE_NAME="<YOUR IMAGE NAME HERE>"

if [ $# = 1 ]; then
	IMAGE_NAME="$1"
fi

echo "Building image '$IMAGE_NAME'..."
docker build -t $IMAGE_NAME .

FYI:
I will be implementing another argument for the /compile endpoint to allow for multiple language support in the next 10 days or so.

Thank you @AlexanderCollins! I will add this to the readme.