Run yarn build inside Dockerfile #912
-
Hi, In order to build and deploy the swan-partner-frontend (https://swan-io.github.io/swan-partner-frontend/build-deploy) we have to run I am no expert in Docker, is it possible to modify the Dockerfile to include the
How would you achieve this ? Thanks ! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
generally we always at least some build steps prior to building the image, so that compilation is part of the CI. what's the issue with Render? not sure I get it |
Beta Was this translation helpful? Give feedback.
-
I managed to achieve this with the following Dockerfile FROM node:22 AS pre-builder
WORKDIR /app
ADD ./ ./
RUN yarn install --pure-lockfile
RUN yarn build
FROM node:22 AS builder
WORKDIR /app
COPY --chown=node:node --from=pre-builder /app/server ./
RUN yarn install --pure-lockfile
FROM node:22
WORKDIR /app
COPY --chown=node:node --from=builder /app ./
CMD ["yarn", "start"]
EXPOSE 8080 |
Beta Was this translation helpful? Give feedback.
I managed to achieve this with the following Dockerfile