Install devDependencies for build, then prune
- Install all dependencies including TypeScript for build - Remove devDependencies after build to keep image small - Fixes TypeScript missing error during Docker build
This commit is contained in:
1 parent
e6805c66a7
commit
5c062fb2cb
1 file changed
+5
-2
+5
-2
@@ -6,8 +6,8 @@ WORKDIR /app
|
|||||||
# Copy package files
|
# Copy package files
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
# Install dependencies (production only)
|
# Install all dependencies (needed for build)
|
||||||
RUN npm ci --only=production
|
RUN npm ci
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
COPY . .
|
COPY . .
|
||||||
@@ -15,6 +15,9 @@ COPY . .
|
|||||||
# Build the application
|
# Build the application
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
|
# Remove devDependencies to reduce image size
|
||||||
|
RUN npm prune --production
|
||||||
|
|
||||||
# Create data directory for encrypted local storage
|
# Create data directory for encrypted local storage
|
||||||
RUN mkdir -p /app/data && chmod 755 /app/data
|
RUN mkdir -p /app/data && chmod 755 /app/data
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user