-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
54 lines (38 loc) · 1.24 KB
/
Dockerfile
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Single-stage Dockerfile for Spring Boot with Py4J Gateway and Python dependencies
FROM maven:3.8.5-openjdk-17 AS build
# Copy the entire project
COPY . /app
# Set working directory
WORKDIR /app
# Build the Spring Boot application
RUN mvn clean package -DskipTests
FROM openjdk:17.0.1-jdk-slim
# Set working directory
WORKDIR /app
# Copy the Spring Boot JAR file
COPY --from=build /app/target/*.jar /app/app.jar
# Install Python and virtual environment package
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv
# Set the working directory for Python scripts
WORKDIR /app
# Copy requirements.txt and install Python packages
COPY requirements.txt /app/requirements.txt
RUN python3 -m venv venv && \
. venv/bin/activate && \
pip3 install --upgrade pip && \
pip3 install -r requirements.txt
COPY src/main/java/com/api/air_quality /app/src/main/java/com/api/air_quality
COPY AI_Models /app/AI_Models
RUN pip3 install python-dotenv
RUN pip3 install py4j
RUN pip3 install joblib
RUN pip3 install requests
RUN pip3 install numpy
RUN pip3 install pandas
RUN pip3 install scikit-learn
# Expose ports
EXPOSE 3269
# Define environment variable
ENV NAME World
# Run the Spring Boot application
ENTRYPOINT ["java", "-jar", "app.jar"]