ABAO77 commited on
Commit
d976edd
·
verified ·
1 Parent(s): 2d7b420

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -71
Dockerfile CHANGED
@@ -1,81 +1,14 @@
1
- # Use Ubuntu as base image for better compatibility
2
- FROM ubuntu:22.04
3
 
4
- # Prevent interactive prompts during package installation
5
- ENV DEBIAN_FRONTEND=noninteractive
6
 
7
- # Update and install essential packages
8
- RUN apt-get update && apt-get install -y \
9
- # Python 3.11 and pip
10
- software-properties-common \
11
- python3.11 \
12
- python3.11-dev \
13
- python3-pip \
14
- python3.11-venv \
15
- # C/C++ compilers and tools
16
- build-essential \
17
- gcc \
18
- g++ \
19
- make \
20
- # Java 17 (full JDK)
21
- openjdk-17-jdk \
22
- # Version control and utilities
23
- git \
24
- curl \
25
- wget \
26
- vim \
27
- # Process monitoring
28
- procps \
29
- htop \
30
- # Clean up
31
- && apt-get clean \
32
- && rm -rf /var/lib/apt/lists/*
33
-
34
- # Set Python 3.11 as default python3
35
- RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \
36
- && update-alternatives --set python3 /usr/bin/python3.11
37
-
38
- # Set JAVA_HOME
39
- ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
40
- ENV PATH="$JAVA_HOME/bin:$PATH"
41
-
42
- # Create app directory
43
  WORKDIR /app
44
 
45
- # Create non-root user
46
- RUN useradd -m -u 1000 -s /bin/bash user && \
47
- chown -R user:user /app
48
-
49
- # Give user permissions to create temp directories
50
- RUN mkdir -p /tmp/code_workspace && \
51
- chown -R user:user /tmp/code_workspace && \
52
- chmod 755 /tmp/code_workspace
53
-
54
- # Switch to non-root user
55
- USER user
56
-
57
- # Set user paths
58
- ENV PATH="/home/user/.local/bin:$PATH"
59
- ENV PYTHONPATH="/app:$PYTHONPATH"
60
-
61
- # Copy requirements first (for better caching)
62
- COPY --chown=user:user requirements.txt .
63
 
64
- # Install Python dependencies
65
- RUN pip3 install --no-cache-dir --upgrade pip && \
66
- pip3 install --no-cache-dir -r requirements.txt
67
 
68
- # Copy application files
69
- COPY --chown=user:user . .
70
 
71
- # Verify installations
72
- RUN echo "=== Version Check ===" && \
73
- python3 --version && \
74
- pip3 --version && \
75
- java -version && \
76
- javac -version && \
77
- gcc --version && \
78
- g++ --version
79
 
80
  # Expose port
81
  EXPOSE 7860
 
1
+ FROM openjdk:17-slim
 
2
 
3
+ RUN apt-get update && apt-get install -y python3 python3-pip
 
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  WORKDIR /app
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ COPY . .
 
 
9
 
10
+ RUN pip3 install -r requirements.txt
 
11
 
 
 
 
 
 
 
 
 
12
 
13
  # Expose port
14
  EXPOSE 7860