diff --git a/Dockerfile b/Dockerfile index 07153148..f35dc559 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,14 @@ FROM docker.io/node:alpine as builder RUN apk add --no-cache git python3 build-base -COPY . /app + WORKDIR /app -RUN yarn install \ - && yarn build + +# Copy package.json and yarn.lock and install dependencies first to speed up subsequent builds +COPY package.json yarn.lock /app/ +RUN yarn install + +COPY . /app +RUN yarn build FROM docker.io/nginx:alpine diff --git a/Dockerfile-dev b/Dockerfile-dev index 08dd9abd..7212a4ae 100644 --- a/Dockerfile-dev +++ b/Dockerfile-dev @@ -1,7 +1,12 @@ FROM docker.io/node:alpine RUN apk add --no-cache git python3 build-base -COPY . /code + WORKDIR /code + +# Copy package.json and yarn.lock and install dependencies first to speed up subsequent builds +COPY package.json yarn.lock /code/ RUN yarn install + +COPY . /code EXPOSE 3000 ENTRYPOINT ["yarn", "start"]