-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
88 lines (73 loc) · 2.85 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
####################################################
# START GLOBAL DECLARATION
####################################################
ARG REPO_NAME_DEFAULT=indexing-service
ARG REPO_PORT_DEFAULT=8050
ARG SERVICE_ROOT_DIRECTORY_DEFAULT=/spring/
####################################################
# END GLOBAL DECLARATION
####################################################
####################################################
# Building environment (java & git)
####################################################
FROM python:3.13 AS build-env-java
LABEL [email protected]
LABEL stage=build-env
# Install git as additional requirement
RUN apt-get update && \
apt-get upgrade --no-install-recommends --assume-yes && \
apt-get install --no-install-recommends --assume-yes git && \
wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb && \
dpkg -i jdk-21_linux-x64_bin.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
####################################################
# Building service
####################################################
FROM build-env-java AS build-service-indexing
LABEL [email protected]
LABEL stage=build-contains-sources
# Fetch arguments from above
ARG REPO_NAME_DEFAULT
ARG SERVICE_ROOT_DIRECTORY_DEFAULT
# Declare environment variables
ENV REPO_NAME=${REPO_NAME_DEFAULT}
ENV SERVICE_DIRECTORY=$SERVICE_ROOT_DIRECTORY_DEFAULT$REPO_NAME
# Create directory for repo
RUN mkdir -p /git/${REPO_NAME}
WORKDIR /git/${REPO_NAME}
COPY . .
RUN cp settings/application-docker.properties settings/application-default.properties
# Build service in given directory
RUN bash ./build4docker.sh $SERVICE_DIRECTORY
####################################################
# Runtime environment 4 indexing-service
####################################################
FROM python:3.13 AS run-service-indexing
LABEL [email protected]
LABEL stage=run
# Fetch arguments from above
ARG REPO_NAME_DEFAULT
ARG REPO_PORT_DEFAULT
ARG SERVICE_ROOT_DIRECTORY_DEFAULT
# Declare environment variables
ENV REPO_NAME=${REPO_NAME_DEFAULT}
ENV SERVICE_DIRECTORY=${SERVICE_ROOT_DIRECTORY_DEFAULT}${REPO_NAME}
ENV REPO_PORT=${REPO_PORT_DEFAULT}
# Install JDK17
RUN apt-get update && \
apt-get upgrade --no-install-recommends --assume-yes && \
wget https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.deb && \
dpkg -i jdk-21_linux-x64_bin.deb && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install python3 & pip3 as additional requirement
RUN pip3 install --no-cache-dir xmltodict==0.13.0 wget==3.2
# Copy service from build container
RUN mkdir -p ${SERVICE_DIRECTORY}
WORKDIR ${SERVICE_DIRECTORY}
COPY --from=build-service-indexing ${SERVICE_DIRECTORY} ./
ENV PYTHONIOENCODING=UTF-8
# Define repo port
EXPOSE ${REPO_PORT}
ENTRYPOINT ["bash", "./run.sh"]