Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:14

RUN mkdir -p /usr/app
WORKDIR /usr/app

COPY package.json .
COPY package-lock.json .

RUN npm ci

COPY . .

CMD [ "npm", "run", "start" ]
19 changes: 19 additions & 0 deletions docker.readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Docker

## Running locally with Docker (Advanced)
- Install Docker https://docs.docker.com/get-docker/
- From a terminal navigate to this directory
- Run the command `npm run start:docker`
- Open another terminal window/tab and test that everything works using the command `curl http://0.0.0.0:8282`
- To exit the running service navigate back to the tab in which you started it and press ctrl+c

## Developing locally with Docker
If you wish to experiment with the code of a service run the command `npm run start:docker:watch`. This command
will rebuild and restart the server every time you save a change to the service's code.

## Troubleshooting
Docker should just work but if there are any issues that first port of call is to "turn it off and back on again":
- Stop all running containers/services `docker stop $(docker ps -a -q)`
- Remove all containers/services `docker rm $(docker ps -a -q)`
- Remove all created images `docker rmi $(docker images -aq)`
- Start the service again `npm run start:docker`
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ app.options('*',cors());
// point to exposed resources for this API
app.use('/',resources);

console.log('MOOOOO');

// start listening for requests
app.listen(port, () => console.log(`listening on port ${port}!`));
Loading