feat: support vite build for docker based installations (#10225)
- Switch to `pnpm` from `yarn` for docker builds
This commit is contained in:
@@ -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/
|
||||
|
||||
Reference in New Issue
Block a user