ciyidogan commited on
Commit
a12a7e7
Β·
verified Β·
1 Parent(s): 908d5cd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -4
Dockerfile CHANGED
@@ -1,6 +1,10 @@
1
  # ============================== BASE IMAGE ==============================
 
 
 
2
  # Build Angular UI
3
  FROM node:18-slim AS angular-build
 
4
  WORKDIR /app
5
 
6
  # Copy package files first for better caching
@@ -16,10 +20,23 @@ COPY flare-ui/ ./
16
  # βœ… Clean Angular cache before build
17
  RUN rm -rf .angular/ dist/ node_modules/.cache/
18
 
19
- # Build the Angular app for DEVELOPMENT ***
20
- RUN npm run build --delete-output-path
21
- # Build the Angular app for PRODUCTION ***
22
- #RUN npm run build --delete-output-path
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  # Debug: List directories to see where the build output is
25
  RUN ls -la /app/flare-ui/ && ls -la /app/flare-ui/dist/ || true
 
1
  # ============================== BASE IMAGE ==============================
2
+ # Build argument
3
+ ARG BUILD_ENV=production
4
+
5
  # Build Angular UI
6
  FROM node:18-slim AS angular-build
7
+
8
  WORKDIR /app
9
 
10
  # Copy package files first for better caching
 
20
  # βœ… Clean Angular cache before build
21
  RUN rm -rf .angular/ dist/ node_modules/.cache/
22
 
23
+ # Build the Angular app based on BUILD_ENV
24
+ RUN if [ "$BUILD_ENV" = "development" ] ; then \
25
+ echo "πŸ”§ Building for DEVELOPMENT..." && \
26
+ npm run build -- --configuration=development \
27
+ --source-map=true \
28
+ --named-chunks=true \
29
+ --vendor-chunk=true \
30
+ --output-hashing=none \
31
+ --output-path=dist/flare-ui ; \
32
+ else \
33
+ echo "πŸš€ Building for PRODUCTION..." && \
34
+ npm run build -- --configuration=production \
35
+ --output-path=dist/flare-ui ; \
36
+ fi
37
+
38
+ # Add environment info to container
39
+ ENV BUILD_ENVIRONMENT=$BUILD_ENV
40
 
41
  # Debug: List directories to see where the build output is
42
  RUN ls -la /app/flare-ui/ && ls -la /app/flare-ui/dist/ || true