diff --git a/Dockerfile b/Dockerfile index 1dadeb5..0a2253c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/README.md b/README.md index 17b36a5..66fd5bb 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/compose.yml b/compose.yml index b2b7bda..e0217e2 100644 --- a/compose.yml +++ b/compose.yml @@ -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