mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-09 23:48:36 +01:00
update dockerfile
This commit is contained in:
@@ -1,38 +1,28 @@
|
||||
# Start with a minimal Node.js base image
|
||||
|
||||
FROM node:21-alpine as base
|
||||
|
||||
# Install pnpm globally with caching to avoid reinstalling if nothing has changed
|
||||
RUN npm i -g pnpm
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /home/app
|
||||
|
||||
# Copy only package-related files to leverage caching
|
||||
COPY --link ./package.json ./tsconfig.json ./pnpm-lock.yaml ./
|
||||
COPY --link ./scripts/package.json ./scripts/pnpm-lock.yaml ./scripts/
|
||||
COPY --link ./shared/package.json ./shared/pnpm-lock.yaml ./shared/
|
||||
COPY --link ./producer/package.json ./producer/pnpm-lock.yaml ./producer/
|
||||
|
||||
# Install dependencies for each package
|
||||
RUN pnpm install
|
||||
RUN pnpm install --filter producer
|
||||
|
||||
WORKDIR /home/app/scripts
|
||||
RUN pnpm install --frozen-lockfile
|
||||
RUN pnpm install
|
||||
|
||||
WORKDIR /home/app/shared
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
WORKDIR /home/app/producer
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Now copy the rest of the source files
|
||||
WORKDIR /home/app
|
||||
|
||||
COPY --link ../scripts ./scripts
|
||||
COPY --link ../shared ./shared
|
||||
COPY --link ../producer ./producer
|
||||
|
||||
# Build the producer
|
||||
WORKDIR /home/app/producer
|
||||
|
||||
RUN pnpm run build_all
|
||||
RUN pnpm run build
|
||||
|
||||
# Start the application
|
||||
CMD ["node", "/home/app/producer/dist/producer/src/index.js"]
|
||||
Reference in New Issue
Block a user