Add Helpful Docker Commands

This commit is contained in:
Neal Chambers
2024-10-23 23:18:36 +09:00
committed by Neal Chambers
parent efe0a2a701
commit b4aaa0fae1

View File

@@ -44,6 +44,26 @@ $ docker/build
```sh
$ docker/server
```
* Alternatively, you can run the server in detached mode. This will return you to the terminal prompt without stopping the server. No logs will be displayed:
```sh
$ docker compose up -d
```
* To stop the server, run:
```sh
$ docker compose down
```
* To access the server logs, run:
```sh
$ docker compose logs -f
```
* To run tests or access the server directly, you can use bash:
```sh
$ docker compose exec web bash
```
* Once you have connected, you can run tests and other operations without `bundle exec`:
```sh
$ rspec spec/models/voucher_spec.rb
```
* The default admin user is 'ofn@example.com' with the password 'ofn123'.
* View the app in the browser at `http://localhost:3000`.
* You will then get the trace of the containers in the terminal. You can stop the containers using Ctrl-C in the terminal.
@@ -73,6 +93,26 @@ $ docker/build.ps1
```command
$ docker/server.ps1
```
* Alternatively, you can run the server in detached mode. This will return you to the terminal prompt without stopping the server. No logs will be displayed:
```sh
$ docker compose up -d
```
* To stop the server, run:
```sh
$ docker compose down
```
* To access the server logs, run:
```sh
$ docker compose logs -f
```
* To run tests or access the server directly, you can use bash:
```sh
$ docker compose exec web bash
```
* Once you have connected, you can run tests and other operations without `bundle exec`:
```sh
$ rspec spec/models/voucher_spec.rb
```
You may need to wait several minutes before getting the server up and running properly.
* The default admin user is 'ofn@example.com' with the password 'ofn123'.
* View the app in the browser at `http://localhost:3000`.