Skip to content

Instantly share code, notes, and snippets.

@ziedHamdi
Last active September 18, 2021 10:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ziedHamdi/2e0b0631922f9d6eefe068c843410ce5 to your computer and use it in GitHub Desktop.
Save ziedHamdi/2e0b0631922f9d6eefe068c843410ce5 to your computer and use it in GitHub Desktop.
Example of docker file
# syntax=docker/dockerfile:1
# docker build . -t graphql:1.0.0
# docker run -d --name graphql_server graphql:1.0.0
# docker ps -a
# docker logs [name]
# docker exec -it [name] /bin/sh
# babel is under node_modules/.bin
# docker rm [name] //removes runtime conainer
# docker rm $(docker ps -a -q) //removes all stopped containers
# docker rmi [imageId] //removes image by id
# check here for more: https://www.codenotary.com/blog/extremely-useful-docker-commands/
FROM node:14.17.3-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY . .
RUN yarn install --production=false && \
yarn build && \
rm -rf src/ && \
rm -rf config/ && \
rm -rf node_modules && \
yarn install \
CMD [ "node", "./dist/server/server.js" ]
#CMD ["sleep", "infinity"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment