NitinBot002 commited on
Commit
e7741c8
·
verified ·
1 Parent(s): 4aa79f6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -12
Dockerfile CHANGED
@@ -1,27 +1,38 @@
1
- # Start with Java image and add Python
2
- FROM eclipse-temurin:17-jre
3
 
4
- # Install Python and pip
5
  RUN apt-get update && apt-get install -y \
6
- python3 \
7
- python3-pip \
8
  curl \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # Create symbolic links for python and pip
12
- RUN ln -s /usr/bin/python3 /usr/bin/python
 
13
 
14
  # Set working directory
15
  WORKDIR /app
16
 
17
  # Upgrade pip
18
- RUN python -m pip3 install --upgrade pip3
19
 
20
- # Install coral-server
21
- RUN pip3 install coral-server
22
 
23
  # Expose port 5555
24
  EXPOSE 5555
25
 
26
- # Run coral-server
27
- CMD ["coral-server","--p", "5555"]
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a base image that has both Python and Java
2
+ FROM python:3.11-slim
3
 
4
+ # Install Java (OpenJDK 17) and other dependencies
5
  RUN apt-get update && apt-get install -y \
6
+ openjdk-17-jre-headless \
 
7
  curl \
8
  && rm -rf /var/lib/apt/lists/*
9
 
10
+ # Set JAVA_HOME environment variable
11
+ ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
12
+ ENV PATH="${JAVA_HOME}/bin:${PATH}"
13
 
14
  # Set working directory
15
  WORKDIR /app
16
 
17
  # Upgrade pip
18
+ RUN pip install --upgrade pip
19
 
20
+ # Install coral-server from PyPI
21
+ RUN pip install coral-server
22
 
23
  # Expose port 5555
24
  EXPOSE 5555
25
 
26
+ # Create a non-root user to run the application
27
+ RUN useradd -m -u 1000 coral && \
28
+ chown -R coral:coral /app
29
+
30
+ # Switch to non-root user
31
+ USER coral
32
+
33
+ # Health check
34
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
35
+ CMD curl -f http://localhost:5555/health || exit 1
36
+
37
+ # Run coral-server on port 5555
38
+ CMD ["coral-server","--port", "5555"]