mirror of
https://github.com/aurora-dot/pastel.codes.git
synced 2024-11-24 00:52:19 +00:00
Attempt to add dockerfile
This commit is contained in:
parent
32bdec59fe
commit
84c82f6a56
2
.gitignore
vendored
2
.gitignore
vendored
@ -195,3 +195,5 @@ fabric.properties
|
|||||||
.idea/caches/build_file_checksums.ser
|
.idea/caches/build_file_checksums.ser
|
||||||
|
|
||||||
notes
|
notes
|
||||||
|
|
||||||
|
.secrets
|
2
app.js
2
app.js
@ -13,7 +13,7 @@ var contactRouter = require('./routes/contact');
|
|||||||
|
|
||||||
var app = express();
|
var app = express();
|
||||||
|
|
||||||
app.set('trust proxy', 'loopback,uniquelocal');
|
if (process.env.IS_DOCKER != 'true') app.set('trust proxy', 'loopback,uniquelocal');
|
||||||
app.disable('x-powered-by');
|
app.disable('x-powered-by');
|
||||||
|
|
||||||
// view engine setup
|
// view engine setup
|
||||||
|
4
bin/www
4
bin/www
@ -14,7 +14,6 @@ var http = require('http');
|
|||||||
|
|
||||||
var port = normalizePort(process.env.PORT || '7000');
|
var port = normalizePort(process.env.PORT || '7000');
|
||||||
app.set('port', port);
|
app.set('port', port);
|
||||||
console.log(port)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create HTTP server.
|
* Create HTTP server.
|
||||||
@ -26,7 +25,8 @@ var server = http.createServer(app);
|
|||||||
* Listen on provided port, on all localhost.
|
* Listen on provided port, on all localhost.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
server.listen(port, 'localhost');
|
if (process.env.IS_DOCKER == 'true') server.listen(port, '0.0.0.0');
|
||||||
|
else server.listen(port, '127.0.0.1');
|
||||||
server.on('error', onError);
|
server.on('error', onError);
|
||||||
server.on('listening', onListening);
|
server.on('listening', onListening);
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
FROM node:15.8.0
|
FROM node:15.8.0
|
||||||
|
|
||||||
ENV PORT=
|
ARG port =
|
||||||
ENV NODE_ENV=
|
|
||||||
|
ENV PORT=${port}
|
||||||
|
ENV IS_DOCKER=true
|
||||||
|
ENV NODE_ENV=production
|
||||||
ENV GHOST_KEY=
|
ENV GHOST_KEY=
|
||||||
ENV HCAPTCHA_KEY=
|
ENV HCAPTCHA_KEY=
|
||||||
ENV SENDGRID_API_KEY=
|
ENV SENDGRID_API_KEY=
|
||||||
@ -15,4 +18,4 @@ RUN npm install
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
CMD [ "npm", "start" ]
|
CMD [ "npm", "start" ]
|
||||||
EXPOSE 7000/tcp
|
EXPOSE ${port}/tcp
|
||||||
|
22
pastel-codes.service
Normal file
22
pastel-codes.service
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
[Unit]
|
||||||
|
Description="pastel.codes web service"
|
||||||
|
Documentation=https://pastel.codes.com
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Environment=PORT=7000
|
||||||
|
Environment=NODE_ENV=production
|
||||||
|
Environment=GHOST_KEY=key
|
||||||
|
Environment=HCAPTCHA_KEY=key
|
||||||
|
Environment=SENDGRID_API_KEY=key
|
||||||
|
Environment=TO_MAIL_USER=user
|
||||||
|
Environment=REPLY_TO_MAIL=user
|
||||||
|
Environment=FROM_MAIL_USER=user
|
||||||
|
StandardOutput=syslog
|
||||||
|
SyslogIdentifier=pastel-codes
|
||||||
|
User=web
|
||||||
|
ExecStart=/home/web/pastel.codes/bin/www
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user