An unofficial Dockerfile for CodeBuild, combining the official Docker (in Docker) and Node environments.
Based on AWS' Docker 17.09 and Node 6.3.1 Dockerfiles.
For more information see the official repo.
To use this Dockerfile in your build, create a new CodeBuild project, or update an existing one. Then:
- In the Environment: How to build section, select Specify a Docker image
- Choose Linux as your Environment type
- Choose Other for Custom image type
- For the Custom image ID, enter
tdmalone/codebuild-docker-node
- Select the Privileged checkbox
This will run your build with this image, which is built from this current repo.
Then, in your buildspec.yml
, somewhere before you run or build a Docker image, make sure you execute this:
nohup /usr/local/bin/dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --storage-driver=overlay&
timeout 15 sh -c "until docker info; do echo .; sleep 1; done"
(This comes from this AWS CodeBuild sample).
If you want to run without having to build it:
docker run --interactive --privileged --tty tdmalone/codebuild-docker-node bash
That will download and start a container with the pre-built image, running the bash
shell.
Otherwise, to build it yourself:
- Run
git clone https://github.com/tdmalone/codebuild-docker-node.git
to download this repository to your local machine. - Change to the directory you cloned into, eg.
cd codebuild-docker-node
. - Run
docker build --tag codebuild-docker-node .
to build the Docker image locally. - Once succeeded, you can then run
docker run --interactive --privileged --tty codebuild-docker-node bash
to start the container in abash
shell.
You can see the docker build and docker run references for more.
Based on CodeBuild's Docker 17.09 file, this repo:
- removes the Python installation
- removes the installation of
libmysqlclient-dev=5.5.58-*
due to error E: Version '5.5.58-*' for 'libmysqlclient-dev' was not found - adds the Node 6.3.1 installation
ASL.