Skip to content

Commit

Permalink
Merge pull request #18 from companieshouse/feature/add-debug
Browse files Browse the repository at this point in the history
Add launch config and inspect to nodemon config
  • Loading branch information
PhilipGlover authored Feb 8, 2024
2 parents bf6309c + 4f3f40a commit efb49da
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 29 deletions.
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "Attach to Remote",
"address": "localhost",
"port": 9229,
"restart": true,
"sourceMaps": true,
"remoteRoot": "/app",
"localRoot": "${workspaceFolder}",
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
]
}
]
}
26 changes: 20 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
ARG IMAGE_VERSION="latest"
FROM 416670754337.dkr.ecr.eu-west-2.amazonaws.com/ci-node-runtime-20:${IMAGE_VERSION}
FROM node:20

RUN cp -r ./dist/* ./ && rm -rf ./dist
RUN ls
CMD ["./server.js","--","3000"]
EXPOSE 3000
ARG SSH_KEY
ENV SSH_KEY=$SSH_KEY
# Make ssh dir
RUN mkdir /root/.ssh/
# Create id_rsa from string arg, and set permissions
RUN echo "$SSH_KEY" >/root/.ssh/id_rsa
RUN chmod 600 /root/.ssh/id_rsa
# Create known_hosts
RUN touch /root/.ssh/known_hosts
# Add git providers to known_hosts
RUN ssh-keyscan bitbucket.org >>/root/.ssh/known_hosts
RUN ssh-keyscan github.com >>/root/.ssh/known_hosts
RUN ssh-keyscan gitlab.com >>/root/.ssh/known_hosts
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD [ "npm", "run", "start:watch" ]
# ENTRYPOINT [ "bash" ]
20 changes: 0 additions & 20 deletions Dockerfile.dev

This file was deleted.

4 changes: 2 additions & 2 deletions Tiltfile.dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
custom_build(
ref = '416670754337.dkr.ecr.eu-west-2.amazonaws.com/psc-verification-web:latest',
#the following build-command was updated as specified by https://github.com/companieshouse/docker-chs-development/pull/581
command = 'DOCKER_BUILDKIT=0 docker build --build-arg SSH_PRIVATE_KEY="$(ssh_key_path="$(ssh -G github.com | grep -e \'^identityfile.*\' | head -n1 | sed \'s|^identityfile \\(.*\\)|\\1|\')"; if [ -z "${ssh_key_path}" ]; then echo "Could not find ssh key path for github.com">&2; false; elif [ -f "${ssh_key_path}" ]; then cat "${ssh_key_path}"; else echo "Could not find ssh key for github at ${ssh_key_path}" >&2; false; fi)" --build-arg SSH_PRIVATE_KEY_PASSPHRASE --tag $EXPECTED_REF . -f Dockerfile.dev',
command = 'DOCKER_BUILDKIT=0 docker build --build-arg SSH_PRIVATE_KEY="$(ssh_key_path="$(ssh -G github.com | grep -e \'^identityfile.*\' | head -n1 | sed \'s|^identityfile \\(.*\\)|\\1|\')"; if [ -z "${ssh_key_path}" ]; then echo "Could not find ssh key path for github.com">&2; false; elif [ -f "${ssh_key_path}" ]; then cat "${ssh_key_path}"; else echo "Could not find ssh key for github at ${ssh_key_path}" >&2; false; fi)" --build-arg SSH_PRIVATE_KEY_PASSPHRASE --tag $EXPECTED_REF .',
live_update = [
sync(local_path = './src', remote_path = '/app/src'),
run('npm install', trigger=['./package.json', './package-lock.json'])
Expand All @@ -10,4 +10,4 @@ custom_build(
'./src',
'./src/views'
]
)
)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"ignore": [
"**/*.test.ts"
],
"exec": "npm run build && node dist/server.js"
"exec": "npm run build && node --inspect=0.0.0.0:9229 dist/server.js"
},
"directories": {
"test": "test"
Expand Down

0 comments on commit efb49da

Please sign in to comment.