forked from dehydr8/elevation-of-privilege
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Readded support for a single-container docker deployment as this is n…
…eeded for the heroku example app
- Loading branch information
1 parent
c19a54e
commit ca59bed
Showing
5 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ deploy/ | |
build/ | ||
db/ | ||
**/*.test.js | ||
.heroku/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FROM ubuntu:latest | ||
WORKDIR /usr/src/app | ||
ENV PORT 80 | ||
|
||
RUN apt-get update && apt-get install -y curl | ||
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash | ||
RUN apt-get update && apt-get install -y nginx supervisor nodejs | ||
RUN rm -rf /var/lib/apt/lists/* | ||
|
||
COPY package*.json ./ | ||
RUN npm install | ||
COPY . . | ||
COPY heroku/conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
COPY heroku/conf/nginx.conf /etc/nginx/sites-available/default | ||
|
||
RUN npm run build | ||
RUN cp -a build/. /var/www/html/ | ||
|
||
# add support for $PORT env variable | ||
CMD sed -i -e 's/$PORT/'"$PORT"'/g' /etc/nginx/sites-available/default && /usr/bin/supervisord | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
server { | ||
listen $PORT; | ||
root /var/www/html; | ||
index index.html; | ||
server_name _; | ||
location / { | ||
try_files $uri /index.html; | ||
} | ||
location /api/ { | ||
proxy_pass http://localhost:8001/; | ||
} | ||
location /socket.io/ { | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "upgrade"; | ||
proxy_http_version 1.1; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header Host $host; | ||
proxy_pass http://localhost:8000/socket.io/; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[supervisord] | ||
nodaemon=true | ||
|
||
[program:app] | ||
directory=/usr/src/app | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
command=npm run server | ||
|
||
[program:nginx] | ||
command=/usr/sbin/nginx -g "daemon off;" | ||
priority=900 | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
username=www-data | ||
autorestart=true |