Skip to content

Commit

Permalink
Configure Dockerfile and docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Blyszcz committed Aug 22, 2018
1 parent 66ffc90 commit 0f77d29
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
@@ -0,0 +1,17 @@
.bitbucket-pipelines.yml
.env
.env.dist
.git
.gitignore
.prettierrc
node_modules
data.json
docker-compose.yml
docker-compose.yml.dist
Dockerfile
README.md
src
translations
tsconfig.json
tsconfig.test.json
tslint.json
26 changes: 26 additions & 0 deletions Dockerfile
@@ -0,0 +1,26 @@
FROM node:10

WORKDIR /app

COPY package.json .

# Add credentials on build
ARG SSH_PRIVATE_KEY
ARG SSH_PUBLIC_KEY
RUN mkdir /root/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > /root/.ssh/id_rsa && \
echo "${SSH_PUBLIC_KEY}" > /root/.ssh/id_rsa.pub && \
chmod 600 /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa.pub

# Make sure your domain is accepted
RUN touch /root/.ssh/known_hosts
RUN ssh-keyscan bitbucket.org >> /root/.ssh/known_hosts

RUN npm i --production

COPY . /app

EXPOSE 3000

CMD npm run start
5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -13,8 +13,9 @@
"lint": "tslint -c tslint.json 'src/**/*.ts'",
"lint-fix": "tslint -c tslint.json 'src/**/*.ts' --fix",
"nsp": "nsp check",
"start-producer": "TS_NODE_FILES=true pm2 --name translations-producer start src/services/producer/index.ts",
"start-api": "TS_NODE_FILES=true pm2 start --name translations-api src/services/api/index.ts"
"start": "npm run start-producer & npm run start-api",
"start-producer": "node build/services/producer/index.js",
"start-api": "node build/services/api/index.js"
},
"bin": {
"babelsheet": "./build/services/cli/index.js"
Expand Down
1 change: 1 addition & 0 deletions src/services/producer/index.ts
Expand Up @@ -57,6 +57,7 @@ async function main() {

const everyFiveMinutes = '*/5 * * * *';

main();
schedule.scheduleJob(everyFiveMinutes, () => {
main();
});

0 comments on commit 0f77d29

Please sign in to comment.