Skip to content

Instantly share code, notes, and snippets.

@pablocattaneo
Last active November 30, 2022 14:02
Show Gist options
  • Save pablocattaneo/d298ea448f4c958d74c1d8ccb2b42659 to your computer and use it in GitHub Desktop.
Save pablocattaneo/d298ea448f4c958d74c1d8ccb2b42659 to your computer and use it in GitHub Desktop.
# create a file and name it Dockerfile
FROM node:lts #baseimage
WORKDIR /app #The WORKDIR instruction sets the working directory for any RUN, CMD, ENTRYPOINT, COPY and ADD instructions that follow it in the Dockerfile.
COPY . /app #The COPY instruction copies new files or directories from <src> and adds them to the filesystem of the container at the path <dest>.
RUN yarn global add gatsby-cli #The RUN instruction will execute any commands in a new layer on top of the current image and commit the results. The resulting committed image will be used for the next step in the Dockerfile.
RUN yarn install
EXPOSE 80
CMD ["yarn", "develop"] # There can only be one CMD instruction in a Dockerfile. If you list more than one CMD then only the last CMD will take effect. The main purpose of a CMD is to provide defaults for an executing container. These defaults can include an executable, or they can omit the executable, in which case you must specify an ENTRYPOINT instruction as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment