File size: 993 Bytes
8502c00
9543229
 
8502c00
 
 
 
 
 
 
 
 
9543229
 
 
 
 
 
 
0874f51
 
9543229
0874f51
 
 
 
 
 
 
8502c00
9543229
 
8502c00
9543229
8502c00
9543229
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Use the specific base image
FROM python:3.8-slim-buster

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

# Set up environment variables for the user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set the working directory to the user's home directory
WORKDIR $HOME/app

# Install Java
RUN apt-get update && apt-get install -y openjdk-11-jdk

# Set the JAVA_HOME environment variable
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk-amd64

# Change ownership of the working directory to the user
RUN chown -R user:user $HOME/app

# Switch to the user
USER user

# Copy the Python files and Java program to the Docker image
COPY app.py YourJavaProgram.java requirements.txt $HOME/app/

# Install required Python dependencies
RUN pip install -r $HOME/app/requirements.txt

# Compile the Java program
RUN javac $HOME/app/YourJavaProgram.java

# Expose the desired port
EXPOSE 7860

# Set the command to run the Python application
CMD ["python", "app.py"]