An example Docker, Node and Express app.
cd <project-root>
cp .env.example .env
- Add the appropriate environment variables to
.env
npm i
- Use
docker-compose
for local development:DOCKER_BUILDKIT=0 docker compose -f docker-compose.dev.yml up --build
- We need
DOCKER_BUILDKIT=0
on M1 Macs. - The app will now be running: http://localhost:3000/
- We need
docker ps
will show all running containers.
You can stop the container with: docker stop <name of container>
ex. docker stop clandestine-crawler
In order to SSH into the container use: docker exec -it clandestine-crawler bash
(where clandestine-crawler
is the container name)
If you'd like to preview a release build, follow these instructions.
DOCKER_BUILDKIT=0 docker build -t ff-crawler --target production .
- (leave off the
production
target to build all layers)
- (leave off the
- Optional: if you'd like to run the image in a container, you can do that now by creating a container (
clandestine-crawler
) and mapping port 3000 from the host to the container:docker run -d -p 3000:3000 --name clandestine-crawler ff-crawler
- The app will now be running: http://localhost:3000/
There is a local database available for use in development (when you run docker compose
using the development file). To connect to it, ensure that MARIADB_ROOT_PASSWORD=root
is set in your .env
file and use port 3309
on 127.0.0.1
.
Build the test container: DOCKER_BUILDKIT=0 docker build -t ff-crawler-test --target test .
Run the test container: docker run -it --rm -p 3000:3000 ff-crawler-test