[a] add metrics port export to Dockerfile
All checks were successful
Build and Push Docker Image / docker-build (push) Successful in 11s
All checks were successful
Build and Push Docker Image / docker-build (push) Successful in 11s
This commit is contained in:
parent
9c0daaba4b
commit
7e175c597b
3 changed files with 12 additions and 3 deletions
|
@ -1,10 +1,16 @@
|
|||
# container img
|
||||
FROM node:14
|
||||
WORKDIR /app
|
||||
|
||||
# copy files and install deps
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
|
||||
#
|
||||
# main port
|
||||
EXPOSE 3000
|
||||
|
||||
# metrics port
|
||||
EXPOSE 3001
|
||||
|
||||
CMD ["node", "main.js"]
|
||||
|
|
|
@ -14,12 +14,14 @@ RATE_LIMIT_MINUTES=15 # the amount of time in minutes to rate limit
|
|||
RATE_LIMIT_REQUESTS=100 # amount of max. requests
|
||||
```
|
||||
|
||||
Don't change the `PORT` value when running in a Docker Container. Instead, export a different port and forward that to the container's port `3000`.
|
||||
Don't change the `PORT` and `METRICS_PORT` values when running in a Docker Container.
|
||||
Instead, export a different port and forward that to the container's ports `3000` and `3001` for the main API port and the metrics port respectively.
|
||||
|
||||
```yml
|
||||
# example for docker-compose.yml:
|
||||
ports:
|
||||
- "5678:3000"
|
||||
- "6789:3001"
|
||||
```
|
||||
|
||||
You also have to mount the `.env` file inside the container, if you're using Docker:
|
||||
|
|
|
@ -3,6 +3,7 @@ services:
|
|||
image: gitpot.org/sangelo/plausible-pageviews-api:main
|
||||
container_name: plausible-pageviews-api
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "3000:3000" # main port
|
||||
- "3001:3001" # metrics port
|
||||
volumes:
|
||||
- ./.env:/app/.env
|
||||
|
|
Loading…
Reference in a new issue