Skip to content

Commit

Permalink
Merge pull request #1442 from navikt/oppskrift-for-å-debugge-frackend…
Browse files Browse the repository at this point in the history
…-som-kjører-i-docker

Oppsett for å debugge inni docker
  • Loading branch information
johannbm authored Apr 19, 2024
2 parents b38a53c + 3040cc3 commit f65472c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 88 deletions.
6 changes: 6 additions & 0 deletions apps/frackend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM gcr.io/distroless/nodejs20-debian12:nonroot
COPY . /app

WORKDIR /app
EXPOSE 8080
CMD ["--inspect=0.0.0.0:9229", "dist/index.js"]
31 changes: 23 additions & 8 deletions apps/frackend/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# Frontend for teams
# Frackend for teamkatalogen

### Requires node 16
### Hent secret

### Set up local env
run python script localenv_setup.py for å få korrekte azure varaiable etc fra k8s secrets
```bash
gcloud auth login

`python3 localenv_setup.py`
# Fra rot kjører du:
python setup_local_azure_secrets.py
```

### Install deps
### Installer pakker
`npm ci`

### Kjør Frackend
`npm run start`
### Bygg Frackend
`npm run build`

### Kjør docker-compose
`docker-compose up -d --build`
Denne fyrer opp lokal Wonderwall + Frackend

### Debug Frackend som kjører i Docker
Når Express-serveren kjører lokalt i Docker så eksponerer den port 9229 som du kan koble en debugger til.

For å få til dette må du lage en debug configuration:
1. Edit configurations
2. Klikk + og velg `attach to Node.js/Chrome`
3. Host: `localhost` port `9229`
4. Kjør så konfigurasjonen og du er klar til å debugge!
4 changes: 3 additions & 1 deletion apps/frackend/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ services:
upstream:
build:
context: .
dockerfile: "Dockerfile"
dockerfile: "Dockerfile.dev"
ports:
- "8081:8081"
- "9229:9229"
environment:
DEBUG: "http-proxy-middleware*"
NODE_ENV: "development"
EXPRESS_PORT: 8081
EXPRESS_HOST: "::"
Expand Down
75 changes: 0 additions & 75 deletions apps/frackend/localenv_setup.py

This file was deleted.

4 changes: 0 additions & 4 deletions apps/frackend/template.localenv

This file was deleted.

0 comments on commit f65472c

Please sign in to comment.