Created
January 16, 2017 18:09
-
-
Save ambethia/95d58652e166ffd7d286768b47bd8648 to your computer and use it in GitHub Desktop.
Notes on Docker+Heroku
This file contains hidden or 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
{ | |
"name": "Kredits", | |
"repository": "https://github.com/ambethia/kredits-server", | |
"addons": [ | |
"heroku-postgresql" | |
] | |
} |
This file contains hidden or 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
version: '2' | |
services: | |
web: | |
build: . | |
command: 'bash -c ''yarn start''' | |
working_dir: /usr/src/app | |
environment: | |
PORT: 8080 | |
DATABASE_URL: postgres://postgres:@herokuPostgresql:5432/postgres | |
ports: | |
- '8080:8080' | |
links: | |
- herokuPostgresql | |
shell: | |
build: . | |
command: bash | |
working_dir: /usr/src/app | |
environment: | |
PORT: 8080 | |
DATABASE_URL: postgres://postgres:@herokuPostgresql:5432/postgres | |
ports: | |
- '8080:8080' | |
links: | |
- herokuPostgresql | |
volumes: | |
- '.:/usr/src/app' | |
herokuPostgresql: | |
image: postgres |
This file contains hidden or 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
FROM node | |
ENV NODE_ENV production | |
WORKDIR /usr/src/app | |
RUN curl -o- -L https://yarnpkg.com/install.sh | bash | |
ENV PATH /root/.yarn/bin:$PATH | |
COPY package.json yarn.lock migrations index.js ./ | |
RUN yarn | |
CMD /root/.yarn/bin/yarn start |
This file contains hidden or 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
const http = require('http') | |
const PostGraphQL = require('postgraphql').default | |
const DATABASE_URL = process.env.DATABASE_URL || 'postgres://localhost:5432' | |
const PORT = process.env.PORT || 3000 | |
http.createServer(PostGraphQL(DATABASE_URL, { graphiql: true })).listen(PORT) |
This file contains hidden or 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
{ | |
"private": true, | |
"scripts": { | |
"start": "node index.js", | |
"deploy": "heroku container:push" | |
}, | |
"dependencies": { | |
"pg": "^6.1.2", | |
"postgraphql": "^2.5.0", | |
"yepql": "^2.2.1" | |
}, | |
"devDependencies": { | |
"eslint": "^3.13.1", | |
"eslint-config-standard": "^6.2.1", | |
"eslint-plugin-promise": "^3.4.0", | |
"eslint-plugin-standard": "^2.0.1" | |
}, | |
"engines": { | |
"node": "7.4.0" | |
} | |
} |
This file contains hidden or 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
web: yarn start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment