Spaces:
Running
Running
Update Dockerfile
Browse files- 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
|
20 |
-
RUN
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|