Build and run a local repo

Data Commons provides two prebuilt images in the Google Artifact Registry that you can download to run in a Docker container:

  • This is a tested, stable version but may be several weeks old.
  • This is the latest built version that is running in production.

If you want to pick up the latest prebuilt version, run the following command:

docker pull

Then, restart Docker, specifying that repo as the argument to the docker run command.

If you have local changes that need to be built, or you are ready to deploy your site to Google Cloud, follow the procedures below.

Build the local repo

If you need to rebuild the repo locally, you must also update the mixer and import submodules.

  1. From the website directory, sync to the latest version of the files in the repo:

    git submodule foreach git pull origin master
    git submodule update --init --recursive
    git pull
  2. Run the following command to build the repo:

    docker build --tag datacommons-website-compose:DOCKER_TAG \
    -f build/web_compose/Dockerfile \
    -t website-compose .

    The DOCKER_TAG is a meaningful description of the version you are building.

It will take several minutes to build.

To run the container with the local SQLite database, start the Docker container as described below.

To run the container with a remote Cloud SQL database, see Start the Docker container with Cloud data for procedures.

To upload and deploy the container to the Cloud, see Deploy a custom instance to Google Cloud for procedures.

Run the container with the local SQLite database

To start the services using the locally built repo. If you have made changes to any of the UI components, be sure to map the custom directories to the Docker workspace directory.

docker run -it \
--env-file $PWD/custom_dc/sqlite_env.list \
-p 8080:8080 \
-e DEBUG=true \
[-v $PWD/custom_dc/CUSTOM_DATA_DIRECTORY:/userdata \]
[-v $PWD/server/templates/custom_dc/custom:/workspace/server/templates/custom_dc/custom \]
[-v $PWD/static/custom_dc/custom:/workspace/static/custom_dc/custom \]