Fix #1564: Use Procfile for process types in Dockerfile apps
* Document new Procfile feature * Add and update tests * Fix a typo in generate_scale_file (ref #1923)
This commit is contained in:
committed by
Jose Diaz-Gonzalez
parent
8e297cd38e
commit
6a01abb905
1
tests/apps/dockerfile-procfile/CHECKS
Normal file
1
tests/apps/dockerfile-procfile/CHECKS
Normal file
@@ -0,0 +1 @@
|
||||
/ nodejs/express
|
||||
16
tests/apps/dockerfile-procfile/Dockerfile
Normal file
16
tests/apps/dockerfile-procfile/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM ubuntu:trusty
|
||||
ENV LC_ALL C
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV DEBCONF_NONINTERACTIVE_SEEN true
|
||||
EXPOSE 3001/udp
|
||||
EXPOSE 3000/tcp
|
||||
EXPOSE 3003
|
||||
|
||||
RUN apt-get install -y software-properties-common && add-apt-repository ppa:chris-lea/node.js && apt-get update
|
||||
RUN apt-get install -y build-essential curl postgresql-client-9.3 nodejs git
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm install
|
||||
|
||||
CMD npm start
|
||||
8
tests/apps/dockerfile-procfile/Procfile
Normal file
8
tests/apps/dockerfile-procfile/Procfile
Normal file
@@ -0,0 +1,8 @@
|
||||
###############################
|
||||
# DEVELOPMENT #
|
||||
###############################
|
||||
|
||||
# Procfile for development using the new threaded worker (scheduler, twitter stream and delayed job)
|
||||
cron: node worker.js
|
||||
web: node web.js
|
||||
worker: node worker.js
|
||||
2
tests/apps/dockerfile-procfile/check_deploy
Executable file
2
tests/apps/dockerfile-procfile/check_deploy
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e; output="$(curl -s -S "$1")"; echo "$output"; test "$output" == "nodejs/express"
|
||||
13
tests/apps/dockerfile-procfile/package.json
Normal file
13
tests/apps/dockerfile-procfile/package.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "2.5.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "4.2.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "false"
|
||||
}
|
||||
}
|
||||
12
tests/apps/dockerfile-procfile/web.js
Normal file
12
tests/apps/dockerfile-procfile/web.js
Normal file
@@ -0,0 +1,12 @@
|
||||
var express = require('express');
|
||||
|
||||
var app = express.createServer(express.logger());
|
||||
|
||||
app.get('/', function(request, response) {
|
||||
response.send('nodejs/express');
|
||||
});
|
||||
|
||||
var port = process.env.PORT || 5000;
|
||||
app.listen(port, function() {
|
||||
console.log("Listening on " + port);
|
||||
});
|
||||
6
tests/apps/dockerfile-procfile/worker.js
Normal file
6
tests/apps/dockerfile-procfile/worker.js
Normal file
@@ -0,0 +1,6 @@
|
||||
function worker() {
|
||||
console.log('sleeping for 60 seconds');
|
||||
setTimeout(worker, 60 * 1000);
|
||||
}
|
||||
|
||||
worker();
|
||||
Reference in New Issue
Block a user