Skip to content

Commit

Permalink
Rewrite Dockerfile
Browse files Browse the repository at this point in the history
Add build cache for yarn install command
Remove unnecessary mkdir command
  • Loading branch information
Tarliton authored and miltonbsn committed Feb 4, 2024
1 parent 34c3c98 commit 4e9edd0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM node:16-alpine
RUN mkdir -p /usr/src/app
ENV APP_PATH /usr/src/app
COPY package.json $APP_PATH
WORKDIR $APP_PATH
RUN yarn install
COPY . $APP_PATH

WORKDIR /usr/src/app

COPY yarn.lock package.json .

RUN --mount=type=cache,target=/root/.yarn --mount=type=cache,target=/root/.cache YARN_CACHE_FOLDER=/root/.yarn yarn install

COPY . .

# expose port 3000 for server and 9000 for webpack-dev-server
EXPOSE 3000 9000

# run start:frontend and start:dev in parallel
CMD ["yarn", "start:frontend", "start:dev"]

0 comments on commit 4e9edd0

Please sign in to comment.