Skip to content

Commit

Permalink
Merge pull request #577 from reload/bye-bye-docker-compose-node
Browse files Browse the repository at this point in the history
Get rid of node in docker and adjust task cmds
  • Loading branch information
kasperg authored Nov 20, 2023
2 parents 8c0fc82 + 8c39905 commit 4e5f54d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 48 deletions.
25 changes: 8 additions & 17 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ tasks:
dev:install:
summary: Install packages
cmds:
- task dev:cli -- yarn install
- yarn install

dev:start:
summary: Install and run docker compose
cmds:
- task dev:install
- docker compose {{ .DOCKER_COMPOSE_FILES }} up --detach
- yarn dev

dev:stop:
summary: Stop docker compose environment
Expand Down Expand Up @@ -63,34 +64,24 @@ tasks:
dev:storybook:
summary: Run storybook in development mode
cmds:
- task dev:cli -- yarn start:storybook:dev

dev:logs:
summary: Tail docker compose logs for web-pack
cmds:
- docker compose logs node --follow
- yarn start:storybook:dev

dev:reset:
summary: Install development environment and clean up.
cmds:
- task dev:down
- task dev:cli -- yarn clean
- yarn clean
- rm -rf node_modules
- task dev:up

dev:test:
summary: Run tests
cmds:
- docker compose exec node yarn test
- yarn test

dev:lint:
summary: Run linters
cmds:
- task dev:cli -- yarn lint:js
- task dev:cli -- yarn lint:scss
- task dev:cli -- yarn lint:markdown

dev:cli:
summary: Performs command inside container. Expects parameter(s).
cmds:
- docker compose {{ .DOCKER_COMPOSE_FILES }} run --rm node {{.CLI_ARGS}}
- yarn lint:js
- yarn lint:scss
- yarn lint:markdown
19 changes: 0 additions & 19 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
version: '3.7'

services:
node:
image: node:20.9
user: node
init: true
working_dir: /home/node/app
volumes:
- root:/home/node/app
- ~/.npmrc:/home/node/.npmrc
ports:
- "80"
command: 'yarn dev'
tty: true
environment:
VIRTUAL_HOST: dpl-react.docker
VIRTUAL_PORT: 80
SHELL: '/bin/sh'
STORYBOOK_CLIENT_ID: bdc1d425-9117-4867-acb9-c7307ddc2e0f
YARN_CACHE_FOLDER: /home/node/app/.cache/yarn

wiremock:
image: up9inc/wiremock-studio:2.32.0-18
ports:
Expand Down
24 changes: 12 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Danish public libraries.
### Requirements

- [go-task](https://github.com/go-task/task)
- [nvm](https://github.com/nvm-sh/nvm)
- [yarn 1.x](https://classic.yarnpkg.com/lang/en/)
- [Docker](https://www.docker.com/products/docker-desktop)
- [Dory](https://github.com/FreedomBen/dory)

Expand All @@ -24,18 +26,16 @@ npm login --registry=https://npm.pkg.github.com

### Howto

1. Run `task dev:start`
2. Access Storybook at <http://dpl-react.docker>

#### Alternative without Docker

1. Add `127.0.0.1 dpl-react.docker` to your `/etc/hosts` file
2. Ensure that your node version matches what is specified in `package.json`.
3. Install dependencies: `yarn install`
4. Start storybook `sudo yarn start:storybook:dev`
5. If you need to log in through Adgangsplatformen, you need to change
your url to <http://dpl-react.docker/> instead of <http://localhost>. This
avoids getting log in errors
1. Ensure that your Node version matches what is specified in `.nvmrc`.
2. Run `task dev:start`
- Storybook will open automatically in a browser
- The console will contain build and lint information
3. If you need to log in through Adgangsplatformen:
- Add `127.0.0.1 dpl-react.docker` to your `/etc/hosts` file
- [Ensure that Node can bind to port 80](https://gist.github.com/guifromrio/6389682)
- Use <http://dpl-react.docker/> instead of <http://localhost:[port]>
4. If you want to use Wiremock instead of production systems run
`task dev:mocks:start`

#### Step Debugging in Visual Studio Code (no docker)

Expand Down

0 comments on commit 4e5f54d

Please sign in to comment.