feat: support vite build for docker based installations (#10225)

- Switch to `pnpm` from `yarn` for docker builds
This commit is contained in:
Vishnu Narayanan
2024-10-04 14:20:56 +05:30
committed by GitHub
parent 0f26351fd3
commit 83100b8f60

View File

@@ -26,11 +26,22 @@ RUN apk update && apk add --no-cache \
postgresql-dev \
postgresql-client \
nodejs=20.15.1-r0 \
yarn \
git \
&& mkdir -p /var/app \
&& gem install bundler
# Install pnpm and configure environment
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - \
&& echo 'export PNPM_HOME="/root/.local/share/pnpm"' >> /root/.shrc \
&& echo 'export PATH="$PNPM_HOME:$PATH"' >> /root/.shrc \
&& export PNPM_HOME="/root/.local/share/pnpm" \
&& export PATH="$PNPM_HOME:$PATH" \
&& pnpm --version
# Persist the environment variables in Docker
ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
WORKDIR /app
COPY Gemfile Gemfile.lock ./
@@ -48,8 +59,8 @@ RUN if [ "$RAILS_ENV" = "production" ]; then \
else bundle install -j 4 -r 3; \
fi
COPY package.json yarn.lock ./
RUN yarn install
COPY package.json pnpm-lock.yaml ./
RUN pnpm i
COPY . /app
@@ -104,7 +115,11 @@ RUN apk update && apk add --no-cache \
&& gem install bundler
RUN if [ "$RAILS_ENV" != "production" ]; then \
apk add --no-cache nodejs-current yarn; \
apk add --no-cache nodejs-current; \
# Install pnpm and configure environment
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - \
&& source /root/.shrc \
&& pnpm --version; \
fi
COPY --from=pre-builder /gems/ /gems/