Skip to content

Commit

Permalink
chore: fix clean release.
Browse files Browse the repository at this point in the history
The Dockerfile has an "optional" COPY statement that copies over generated development SSL certificates. However COPY fails when given no inputs. So on a clean repo it currently doesn't work. I'm removing the COPY statement from the Dockerfile and instead using (another) volume mount for that. Unfortunately that does require the certificate files to live in a subdirectory.
  • Loading branch information
pieterpaulkramer committed Mar 14, 2021
1 parent b98b779 commit 512b559
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
node_modules/
cert/
package-lock.json
cert.pem
key.pem
csr.pem
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ RUN yarn install --prod --immutable
COPY *.js ./
COPY public public/

# SSL certificates. For testing only: doesn't match any files on a clean repo.
COPY *.pem ./

EXPOSE 3000 9001 10000-11000
CMD ["node", "main.js"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ For local development you need to generate a self-signed certificate as voice me

With those files, you can run the server using:

export SSL_CERT_PATH="./cert.pem" SSL_KEY_PATH="./key.pem"
export SSL_CERT_PATH="./cert/cert.pem" SSL_KEY_PATH="./cert/key.pem"

Or to wherever the key files are located on your production server.

Expand All @@ -35,7 +35,7 @@ For running in production, make sure to set the `ANNOUNCED_IP` environmental var
Proximity Chat can run in a Docker container. Use the following steps to build and run using Docker:

docker build -t proximity-chat .
docker run -d -p 3000:3000 -p 9001:9001 -v "/$(pwd)\public":/usr/src/app/public:ro -e SSL_CERT_PATH="./cert.pem" -e SSL_KEY_PATH="./key.pem" proximity-chat
docker run -d -p 3000:3000 -p 9001:9001 -v "/$(pwd)\public":/usr/src/app/public:ro -v "/$(pwd)\cert":/usr/src/app/cert:ro -e SSL_CERT_PATH="./cert/cert.pem" -e SSL_KEY_PATH="./cert/key.pem" proximity-chat

This also binds your local `public` directory to the container, so that you can test frontend changes more quickly.

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "node --trace-warnings main.js",
"lint": "eslint .",
"lint-fix": "eslint . --fix",
"gen-ssl-certs": "openssl req -new -newkey rsa:2048 -nodes -keyout key.pem -x509 -out cert.pem -days 365 -subj /C=NL/ST=NB/L=Eindhoven/O=Disc/CN=www.demos.nl"
"gen-ssl-certs": "openssl req -new -newkey rsa:2048 -nodes -keyout ./cert/key.pem -x509 -out ./cert/cert.pem -days 365 -subj /C=NL/ST=NB/L=Eindhoven/O=Disc/CN=www.demos.nl"
},
"author": "Meshiest",
"license": "CC0 1.0 Universal",
Expand Down

0 comments on commit 512b559

Please sign in to comment.