1
- FROM python:3.12-slim-bookworm
1
+ # Set the build mode (default to remote)
2
+ ARG BUILD_MODE=remote
3
+ FROM python:3.12.3-bookworm
2
4
3
- # Install required system dependencies
4
- RUN apt-get update && apt-get install -y --no-install-recommends \
5
- git \
6
- gcc \
5
+ ARG BUILD_MODE
6
+ ENV BUILD_MODE=${BUILD_MODE}
7
+
8
+ # Install required tools
9
+ RUN apt-get update && apt-get install -y \
10
+ build-essential \
7
11
curl \
8
- libpq-dev \
9
- python3-distutils \
10
- && apt-get clean \
12
+ git \
13
+ python3-pip \
14
+ software-properties-common \
11
15
&& rm -rf /var/lib/apt/lists/*
12
16
13
- ARG BUILD_MODE=remote
14
- ENV BUILD_MODE=${BUILD_MODE}
15
- ENV PORT=8501
16
-
17
- # Use neutral temp folder for staging
17
+ # Set the workdir to a neutral temp folder first
18
18
WORKDIR /tmp/build-context
19
19
20
- # Remote clone from GitHub
20
+ # Clone OR copy conditionally
21
21
RUN if [ "$BUILD_MODE" = "remote" ]; then \
22
22
git clone https://github.com/curiouslearning/cl-dashboard-internal.git /cl-dashboard-internal ; \
23
23
fi
24
24
25
- # Optional: local copy
25
+ # Copy only if local
26
26
COPY . /tmp/local-copy
27
27
RUN if [ "$BUILD_MODE" = "local" ]; then \
28
28
cp -r /tmp/local-copy /cl-dashboard-internal ; \
29
29
fi
30
30
31
- # Cleanup temp build folders
32
- RUN rm -rf /tmp/local-copy /tmp/build-context /tmp/remote-copy || true
33
-
34
- # Move into app and install requirements
35
31
WORKDIR /cl-dashboard-internal
36
- RUN pip install --no-cache-dir -r requirements.txt
37
32
38
- # Entrypoint
33
+ RUN pip3 install --no-cache-dir -r requirements.txt
34
+
35
+ ENV PORT=8501
36
+
39
37
COPY entrypoint.sh /entrypoint.sh
40
38
RUN chmod +x /entrypoint.sh
41
39
42
- ENTRYPOINT ["/entrypoint.sh" ]
40
+ ENTRYPOINT ["/entrypoint.sh" ]
0 commit comments