Skip to content

Commit 95cce4d

Browse files
Configure server PORT #34
1 parent 9aeb21f commit 95cce4d

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

docker.env .env

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
TOKEN=abc123
2+
PORT=3000
3+
PORTS=3000:3000
24
# DEBUG=DISABLE

.npmrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PORT=3000
2+
HOST=0.0.0.0

Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ RUN pip install docker-compose
2121
# RUN apk add --no-cache make gcc g++ python
2222

2323
# Bundle app source
24-
COPY . /src
24+
ENV WORKDIR /src
25+
COPY . ${WORKDIR}
2526

2627
# Change working directory
27-
WORKDIR "/src"
28+
WORKDIR "${WORKDIR}"
2829

2930
# Install dependencies
3031
RUN npm install --production
3132

3233
# Env variables
33-
ENV SERVER_PORT 3000
34+
ENV SERVER_PORT ${PORT}
3435
# ENV TOKEN abc123
3536
# ENV DEBUG DISABLE
3637

37-
# Expose 3000
38-
EXPOSE 3000
38+
EXPOSE ${PORT}
3939

4040
# Startup
4141
ENTRYPOINT npm start

docker-compose.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
version: '2'
1+
version: '3'
22
services:
33
dockerhub:
44
image: maccyber/micro-dockerhub-hook
55
# build: .
6+
environment:
7+
- PORT=${PORT}
68
ports:
7-
- "3000:3000"
8-
env_file: docker.env
9+
- "${PORT}:${PORT}"
910
volumes:
1011
- ./scripts:/src/scripts
1112
- /var/run/docker.sock:/var/run/docker.sock

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "docker hub webhook",
55
"main": "index.js",
66
"scripts": {
7-
"start": "micro",
7+
"start": "micro -l tcp://${npm_config_HOST}:${npm_config_PORT}",
88
"dev": "micro-dev -H localhost",
99
"test": "standard && ava",
1010
"coverage": "nyc ava",

0 commit comments

Comments
 (0)