|
|
@@ -55,7 +55,8 @@ We've included a sample [Dockerfile](./Dockerfile) which you can build with the
|
|
|
docker build -t vendure .
|
|
|
```
|
|
|
|
|
|
-and then run it with:
|
|
|
+This builds an image and tags it with the name "vendure". We can then run it with:
|
|
|
+
|
|
|
```
|
|
|
# Run the server
|
|
|
docker run -dp 3000:3000 -e "DB_HOST=host.docker.internal" --name vendure-server vendure npm run start:server
|
|
|
@@ -64,6 +65,20 @@ docker run -dp 3000:3000 -e "DB_HOST=host.docker.internal" --name vendure-server
|
|
|
docker run -dp 3000:3000 -e "DB_HOST=host.docker.internal" --name vendure-worker vendure npm run start:worker
|
|
|
```
|
|
|
|
|
|
+Here is a breakdown of the command used above:
|
|
|
+
|
|
|
+- `docker run` - run the image we created with `docker build`
|
|
|
+- `-dp 3000:3000` - the `-d` flag means to run in "detached" mode, so it runs in the background and does not take
|
|
|
+control of your terminal. `-p 3000:3000` means to expose port 3000 of the container (which is what Vendure listens
|
|
|
+on by default) as port 3000 on your host machine.
|
|
|
+- `-e "DB_HOST=host.docker.internal"` - the `-e` option allows you to define environment variables. In this case we
|
|
|
+are setting the `DB_HOST` to point to a special DNS name that is created by Docker desktop which points to the IP of
|
|
|
+the host machine. Note that `host.docker.internal` only exists in a Docker Desktop environment and thus should only be
|
|
|
+used in development.
|
|
|
+- `--name vendure-server` - we give the container a human-readable name.
|
|
|
+- `vendure` - we are referencing the tag we set up during the build.
|
|
|
+- `npm run start:server` - this last part is the actual command that should be run inside the container.
|
|
|
+
|
|
|
### Docker compose
|
|
|
|
|
|
We've included a sample [docker-compose.yml](./docker-compose.yml) file which demonstrates how the server, worker, and
|