Only Docker Desktop is required.
WSL 2 users should follow this guide as well.
git clone https://github.com/wevote/WebApp.git
cd WebApp
cp src/js/config-template.js src/js/config.js
If you are running your own API server (WeVoteServer) locally, change the new config file to point to your local API container (instead of the live API server):
WE_VOTE_SERVER_ROOT_URL: 'http://localhost:8000/',
WE_VOTE_SERVER_ADMIN_ROOT_URL: 'http://localhost:8000/admin/',
WE_VOTE_SERVER_API_ROOT_URL: 'http://localhost:8000/apis/v1/',
WE_VOTE_SERVER_API_CDN_ROOT_URL: 'http://localhost:8000/apis/v1/',
We will run all WeVote docker containers in an isolated docker network. Since the backend (WeVoteServer) and frontend (WebApp) both use docker compose (which typically manages docker networks for us), we must manually create this shared network to avoid conflicts. Even if you are not planning on running your own backend, this step must still be completed.
docker network create wevote
To start the WeVote WebApp service, use one of these commands. You should already be running the WeVoteServer API service. If you are just getting started, we recommend using the first (foreground) method below. These commands assume you are in the WebApp folder created in Step 1 above.
docker compose up
This command builds, (re)creates, and starts the service, and shows the logs in your terminal. Press Ctrl+C to stop the container gracefully.
-
Note: If this errors due to
npm ci, reach out to Marcel Jacquot on Slack -
Note: If you have pulled code from GitHub, execute the compose up command with the
--buildflag to ensure that your images are always up to date. (Dockerfile commands like COPY and RUN that update dependencies are only run during the building stage.) --docker compose up -- build
docker compose up -d
The -d (detached) flag runs the container in the background, leaving it running after you exit the terminal. Once started in detached state, use this command to stop the container:
docker compose down
Once the container is running, you can now access the WebApp at http://localhost:3000/
Open a shell
# Open a shell in the webapp container
docker compose exec webapp shInstall a new npm library
# Install a new library on your local host terminal:
npm install <library-name>
# This updates your local package.json and lockfile.
#Force Docker to rebuild the node_modules layer:
docker compose up --buildFull Rebuild
# Full rebuild, with no cache
docker compose build --no-cacheBeyond full rebuild, clear out any existing volumes (including node_modules)
# Clear out any existing volumes, might be necessary after adding a library with npm
docker compose down -v For now, just change
CMD ["npm", "run", "dev"]
to
CMD ["npm", "run", "dev-ssl"]
in Dockerfile.dev
-
Docker Compose
-
PostgreSQL