forked from buerokratt/CronManager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.python
68 lines (51 loc) · 2.02 KB
/
Dockerfile.python
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM eclipse-temurin:17-jdk AS build
WORKDIR /workspace/app
# Install Python 3.10
RUN apt-get update && apt-get install -y \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Make python3.10 the default python3
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Continue with your existing steps
COPY gradlew .
COPY gradlew.bat .
COPY gradle gradle
COPY build.gradle .
COPY src src
COPY .env .env
COPY scripts scripts
COPY DSL DSL
RUN chmod 754 ./gradlew
RUN ./gradlew -Pprod clean bootJar
RUN mkdir -p build/libs && (cd build/libs; jar -xf *.jar)
FROM eclipse-temurin:17-jdk
VOLUME /build/tmp
# Install Python 3.10 in the second stage as well
RUN apt-get update && apt-get install -y \
software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y python3.10 python3.10-venv python3.10-dev python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
RUN apt-get update && apt-get install -y jq
# Creating python virtual environment to download and store dependencies
RUN python3.10 -m venv /app/python_virtual_env
ARG DEPENDENCY=/workspace/app/build/libs
COPY --from=build ${DEPENDENCY}/BOOT-INF/lib /app/lib
COPY --from=build ${DEPENDENCY}/META-INF /app/META-INF
COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
COPY DSL /DSL
COPY scripts /app/scripts/
COPY constants.ini /app/constants.ini
RUN chmod a+x /app/scripts/*
ENV application.config-path=/DSL
COPY .env /app/.env
RUN echo BUILDTIME=`date +%s` >> /app/.env
RUN adduser cronmanager
RUN chown -R cronmanager:cronmanager /app
RUN chown -R cronmanager:cronmanager /DSL
USER cronmanager
EXPOSE 9010
ENTRYPOINT ["java","-cp","app:app/lib/*","ee.buerokratt.cronmanager.CronManagerApplication"]