I'm migrating a VueJS application from "classic" Yarn 1.x to Yarn 2. Following the install documentation is straightforward and works without problems.
The tricky part comes when packaging the application in a Docker image.
Current Dockerfile
FROM node:14-alpine AS build-stage
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . ./
RUN yarn build --modern \
&& find dist -type f -exec gzip -k "{}" \;
FROM nginx:mainline-alpine as production-stage
RUN apk add --no-cache curl
HEALTHCHECK CMD curl -f http://localhost || exit 1
COPY docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
COPY docker/app.nginx /etc/nginx/conf.d/default.conf
COPY --from=build-stage /app/dist /usr/share/nginx/html
ENTRYPOINT [ "/entrypoint.sh" ]
Maybe I looked in the wrong places but I couldn't find any information how a Yarn 2 Zero-Install setup would look like for a Docker image.
Do you have any recommendation on how to use the Yarn 2 approach in a Dockerfile
?
COPY .yarn ./.yarn
hint, that was what i was looking for. – Disappointment