fix: pnpm in vite docker (#10344)

- Fix pnpm path in vite docker
- Remove webpack files
- fFx vite server port
This commit is contained in:
Vishnu Narayanan
2024-10-29 15:16:10 +05:30
committed by GitHub
parent 0689f59a05
commit 55dfd7db50
6 changed files with 13 additions and 44 deletions

View File

@@ -74,13 +74,13 @@ services:
- cache:/app/tmp/cache
- bundle:/usr/local/bundle
ports:
- "5173:5173" # Vite dev server
- "3036:3036" # Vite dev server
environment:
- VITE_DEV_SERVER_HOST=0.0.0.0
- NODE_ENV=development
- RAILS_ENV=development
entrypoint: docker/entrypoints/vite.sh
command: pnpm run dev
command: bin/vite dev
postgres:
image: postgres:12

View File

@@ -5,7 +5,7 @@ FROM ruby:3.3.3-alpine3.19 AS pre-builder
# For development docker-compose file overrides ARGS
ARG BUNDLE_WITHOUT="development:test"
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}
ENV BUNDLER_VERSION=2.1.2
ENV BUNDLER_VERSION=2.5.11
ARG RAILS_SERVE_STATIC_FILES=true
ENV RAILS_SERVE_STATIC_FILES ${RAILS_SERVE_STATIC_FILES}
@@ -89,7 +89,7 @@ FROM ruby:3.3.3-alpine3.19
ARG BUNDLE_WITHOUT="development:test"
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT}
ENV BUNDLER_VERSION=2.1.2
ENV BUNDLER_VERSION=2.5.11
ARG EXECJS_RUNTIME="Disabled"
ENV EXECJS_RUNTIME ${EXECJS_RUNTIME}
@@ -115,7 +115,7 @@ RUN apk update && apk add --no-cache \
&& gem install bundler
RUN if [ "$RAILS_ENV" != "production" ]; then \
apk add --no-cache nodejs-current; \
apk add --no-cache nodejs=20.15.1-r0; \
# Install pnpm and configure environment
wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh - \
&& source /root/.shrc \

View File

@@ -1,6 +1,9 @@
FROM chatwoot:development
ENV PNPM_HOME="/root/.local/share/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN chmod +x docker/entrypoints/vite.sh
EXPOSE 5173
CMD ["pnpm", "run", "dev"]
EXPOSE 3036
CMD ["bin/vite", "dev"]

View File

@@ -1,6 +0,0 @@
FROM chatwoot:development
RUN chmod +x docker/entrypoints/webpack.sh
EXPOSE 3035
CMD ["bin/webpack-dev-server"]

14
docker/entrypoints/vite.sh Normal file → Executable file
View File

@@ -1,19 +1,11 @@
#!/bin/sh
set -e
set -x
rm -rf /app/tmp/pids/server.pid
rm -rf /app/tmp/cache/*
pnpm install --frozen-lockfile
echo "Waiting for pnpm and bundle integrity to match lockfiles...."
PNPM="pnpm list --json | grep -q 'Missing dependencies'"
BUNDLE="bundle check"
until ! $PNPM && $BUNDLE
do
sleep 2;
done
pnpm store prune
pnpm install
echo "Ready to run Vite development server."

View File

@@ -1,20 +0,0 @@
#!/bin/sh
set -e
rm -rf /app/tmp/pids/server.pid
rm -rf /app/tmp/cache/*
yarn install --check-files
echo "Waiting for yarn and bundle integrity to match lockfiles...."
YARN="yarn check --integrity"
BUNDLE="bundle check"
until $YARN && $BUNDLE
do
sleep 2;
done
echo "Ready to run webpack development server."
exec "$@"