Skip to content

Instantly share code, notes, and snippets.

@hbjydev
Created January 14, 2020 23:42
Show Gist options
  • Save hbjydev/8756f34c60c4605febcdbb4443d9d231 to your computer and use it in GitHub Desktop.
Save hbjydev/8756f34c60c4605febcdbb4443d9d231 to your computer and use it in GitHub Desktop.
FROM node:lts-alpine
# globally install yarn on our docker image
RUN npm i -g yarn typescript
# use changes to package.json to force Docker not to use the cache
# when we change our application's nodejs dependencies:
ADD package.json /tmp/package.json
RUN cd /tmp && yarn
RUN mkdir -p /opt/app && cp -a /tmp/node_modules /opt/app/
# make all commands from here on use /opt/app as their working dir
WORKDIR /opt/app
# add all files in the service to /opt/app
ADD packages/api /opt/app/packages/api
ADD packages/logger /opt/app/packages/logger
# build the typescript app from /opt/app/packages/api
WORKDIR /opt/app/packages/api
RUN yarn build
# run the app
CMD [ "yarn", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment