Update Dockerfile for correct directory structure
Browse files- .dockerignore +10 -0
- Dockerfile +18 -6
.dockerignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.git
|
2 |
+
.gitignore
|
3 |
+
node_modules
|
4 |
+
**/node_modules
|
5 |
+
**/__pycache__
|
6 |
+
*.pyc
|
7 |
+
.next
|
8 |
+
.env
|
9 |
+
.env.*
|
10 |
+
!.env.example
|
Dockerfile
CHANGED
@@ -7,15 +7,20 @@ WORKDIR /app/web
|
|
7 |
# Copy package files first
|
8 |
COPY web/package.json web/yarn.lock ./
|
9 |
|
10 |
-
#
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
# Copy web source files
|
14 |
COPY web/ .
|
15 |
|
16 |
# Build web app with optimizations
|
17 |
-
ENV NODE_ENV=production
|
18 |
-
ENV NEXT_TELEMETRY_DISABLED=1
|
19 |
RUN yarn build
|
20 |
|
21 |
# Python base image for final stage
|
@@ -34,10 +39,17 @@ WORKDIR /app
|
|
34 |
# Copy API files
|
35 |
COPY api/ /app/api/
|
36 |
|
37 |
-
# Install Python dependencies
|
38 |
WORKDIR /app/api
|
|
|
39 |
RUN pip install --no-cache-dir poetry && \
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
poetry install --only main --no-interaction --no-ansi
|
42 |
|
43 |
# Copy built web files from builder stage
|
|
|
7 |
# Copy package files first
|
8 |
COPY web/package.json web/yarn.lock ./
|
9 |
|
10 |
+
# Configure Node to use less memory
|
11 |
+
ENV NODE_OPTIONS="--max_old_space_size=2048"
|
12 |
+
ENV NEXT_TELEMETRY_DISABLED=1
|
13 |
+
ENV NODE_ENV=production
|
14 |
+
|
15 |
+
# Install dependencies with memory optimizations
|
16 |
+
RUN yarn config set network-timeout 300000 && \
|
17 |
+
yarn install --frozen-lockfile --network-timeout 300000 && \
|
18 |
+
yarn cache clean
|
19 |
|
20 |
# Copy web source files
|
21 |
COPY web/ .
|
22 |
|
23 |
# Build web app with optimizations
|
|
|
|
|
24 |
RUN yarn build
|
25 |
|
26 |
# Python base image for final stage
|
|
|
39 |
# Copy API files
|
40 |
COPY api/ /app/api/
|
41 |
|
42 |
+
# Install Python dependencies with memory optimizations
|
43 |
WORKDIR /app/api
|
44 |
+
ENV POETRY_VIRTUALENVS_CREATE=false
|
45 |
RUN pip install --no-cache-dir poetry && \
|
46 |
+
# Install dependencies in smaller groups to avoid memory issues
|
47 |
+
poetry install --only main --no-interaction --no-ansi \
|
48 |
+
--no-root \
|
49 |
+
--with runtime-dependencies && \
|
50 |
+
poetry install --only main --no-interaction --no-ansi \
|
51 |
+
--no-root \
|
52 |
+
--with core-dependencies && \
|
53 |
poetry install --only main --no-interaction --no-ansi
|
54 |
|
55 |
# Copy built web files from builder stage
|