Skip to content

Commit

Permalink
fix(docker): fix watching of app, and re-add it to compose
Browse files Browse the repository at this point in the history
  • Loading branch information
dsluijk committed Jul 26, 2022
1 parent f4667ea commit 74b6388
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ This website is still under construction. This is not in use yet :(.

## Development

To run the application in development, you will have to have an recent version of Node installed (16 or 18).
Additional services are run in Docker, but a compose file is provided.
First you will have to start with with Docker Compose:
Development is done with Docker, with the settings provided.
To run all needed components, a compose file is provided.
Note: the force recreate option is required as there is currently a [known issue](https://github.com/nuxt/framework/issues/3998) with Nuxt in Docker.
This can be run with:

```bash
docker-compose up -d
docker-compose up --force-recreate
```

This exposes several services:

- The application itself at [localhost:3000](http://localhost:3000).
- The Postgres database to connect to, accesible at the default port `5432`.
- An Adminer instance, to explore the database, accesible at [localhost:8080](http://localhost:8080).
- Mailcatcher SMTP server, at port 1025.
- Mailcatcher to view the outgoing email at [localhost:8081](http://localhost:8081).

To then start the server itself, you need to install the dependencies first using `yarn install`.
When this is done you can start the dev server with `yarn dev`.
Now you can view the server at [localhost:3000](http://localhost:3000).
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
version: "3"

services:
server:
image: node:18.6
working_dir: /lan
command: ["sh", "-c", "yarn install && yarn dev"]
container_name: lan-server
restart: unless-stopped
ports:
- 3000:3000
- 24678:24678 # HMR Port
environment:
HOST: "0.0.0.0"
env_file:
- .env
- .env.local
depends_on:
- database
- mailcatcher
volumes:
- ./:/lan
database:
container_name: lan-database
image: "postgres:latest"
Expand Down
13 changes: 12 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
import { defineNuxtConfig } from "nuxt";

// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({});
export default defineNuxtConfig({
typescript: {
strict: true,
},
vite: {
server: {
hmr: {
protocol: "ws",
},
},
},
});
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
"author": "LANDev <[email protected]>",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview"
"dev": "nuxt dev --no-clear",
"build": "nuxt build --prerender",
"serve": "yarn build && nuxt preview",
"typecheck": "nuxt typecheck"
},
"devDependencies": {
"nuxt": "3.0.0-rc.6"
"nuxt": "3.0.0-rc.6",
"serve": "^14.0.1"
}
}

0 comments on commit 74b6388

Please sign in to comment.