Skip to content

Commit dee8b43

Browse files
committed
seems to be working now. apparently the command part of docker-compose
for web takes precedence over the CMD block of the Dockerfile
1 parent 4885ab1 commit dee8b43

File tree

8 files changed

+17
-16
lines changed

8 files changed

+17
-16
lines changed

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ FROM node:6
88
RUN mkdir /code
99
ADD . /code
1010
RUN mkdir /code/build
11-
ADD . /code/builddock
1211
WORKDIR /code
1312
RUN npm install
1413
EXPOSE 80
15-
CMD ["npm", "test"]
16-
14+
CMD ["npm", "run", "start:dev"]

app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var cssnext = require('postcss-cssnext');
1818
rootRequire('config/environments')(app);
1919
app.set('io', require('socket.io').listen(httpServer));
2020

21-
var conString = process.env.DATABASE_URL || "postgres://postgres@localhost/forum";
21+
var conString = process.env.DATABASE_URL || "postgres://postgres@db/forum";
2222

2323
var Sequelize = require('sequelize');
2424
var sequelize = new Sequelize(conString);

docker-compose.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@ services:
44
build: .
55
ports:
66
- 80:3000
7-
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; npm start'
7+
command: bash -c 'while !</dev/tcp/db/5432; do sleep 1; done; npm run start:dev'
88
depends_on:
99
- db
1010
environment:
11-
- DATABASE_URL=postgres://postgres:password@db:5432/forum
11+
- DATABASE_URL=postgres://forum@db:5432/forum
1212
- PORT=3000
1313
- FORUM_STORAGE_ADAPTER=S3
1414
db:
15-
image: postgres
16-
environment:
17-
- POSTGRES_USER=forum
18-
- POSTGRES_PASSWORD=password
19-
- POSTGRES_DB=forum
15+
build:
16+
context: .
17+
dockerfile: ./Dockerfile.postgres
18+
# environment:
19+
# - POSTGRES_USER=forum
20+
# - POSTGRES_DB=forum
21+
# volumes:
22+
# - ./data/postgres:/var/lib/postgresql/data

models/Post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Sequelize = require('sequelize');
2-
var sequelize = new Sequelize(process.env.DATABASE_URL || "postgres://postgres@localhost/forum");
2+
var sequelize = new Sequelize(process.env.DATABASE_URL || "postgres://postgres@db/forum");
33

44
var Post = rootRequire('models/Post.orm')(sequelize);
55

models/User.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Sequelize = require('sequelize');
2-
var sequelize = new Sequelize(process.env.DATABASE_URL || "postgres://postgres@localhost/forum");
2+
var sequelize = new Sequelize(process.env.DATABASE_URL || "postgres://postgres@db/forum");
33

44
var User = rootRequire('models/User.orm')(sequelize);
55

test/integration/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('socket communication', function(){
2525
before(function(done){
2626
// establish database connection:
2727
var Sequelize = require('sequelize');
28-
var sequelize = new Sequelize("postgres://postgres@localhost/" + appModule.app.get('db-test'));
28+
var sequelize = new Sequelize("postgres://postgres@db/" + appModule.app.get('db-test'));
2929

3030
// pending comment
3131
var post = rootRequire('models/Post.orm')(sequelize);

test/integration/db.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var assert = require('assert');
22

33
var Sequelize = require('sequelize');
44

5-
var sequelize = new Sequelize("postgres://postgres@localhost/" + rootRequire('app').app.get('db-test'));
5+
var sequelize = new Sequelize("postgres://postgres@db/" + rootRequire('app').app.get('db-test'));
66

77
var post = rootRequire('models/Post.orm')(sequelize);
88
var user = rootRequire('models/User.orm')(sequelize);

test/test_helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
if (process.env.NODE_ENV === 'test') {
2-
process.env.DATABASE_URL = "postgres://postgres@localhost/forum_test";
2+
process.env.DATABASE_URL = "postgres://postgres@db/forum_test";
33
}
44

55
require('../lib/helpers');

0 commit comments

Comments
 (0)