-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (78 loc) · 3.14 KB
/
Dockerfile
File metadata and controls
91 lines (78 loc) · 3.14 KB
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
89
90
91
# ---------------------------------
# _____ __ __ ______ _
# / ___// /_ ___ / /________ ____ / ____/__ ______________ ______(_)
# \__ \/ __ \/ _ \/ / ___/ __ \/ __ \ / /_ / _ \/ ___/ ___/ __ `/ ___/ /
# ___/ / / / / __/ (__ ) /_/ / / / / / __/ / __/ / / / / /_/ / / / /
# /____/_/ /_/\___/_/____/\____/_/ /_/ /_/ \___/_/ /_/ \__,_/_/ /_/
# ---------------------------------
# Currency Conversion API - Main Dockerfile
# ---------------------------------
# This Dockerfile is responsible for installing, configuring, running, and starting:
# - The Java HTTP server on port 8080
# - The H2 server on port 8092
#
# Dockerfile Features:
# - Uses the OpenJDK 17 slim base image.
# - Installs Maven.
# - Sets the working directory inside the container.
# - Copies the pom.xml file to the container.
# - Downloads Maven dependencies without running tests.
# - Copies the source code files to the container.
# - Copies the sys folder and its contents to the container.
# - Gives execution permission to the callJavaFromDocker.sh script.
# - Installs Maven dependencies and generates the JAR.
# - Exposes ports 8080, 1521, and 81.
# - Sets the default command to start the callJavaFromDocker.sh script.
# ---------------------------------
# ---------------------------------
# Uses the OpenJDK 17 slim base image
# ---------------------------------
FROM openjdk:17-slim
# ---------------------------------
# Installs Maven
# ---------------------------------
RUN apt-get update && apt-get install -y maven
# ---------------------------------
# Sets the working directory inside the container
# ---------------------------------
WORKDIR /app
# ---------------------------------
# Copies the pom.xml file to the container
# ---------------------------------
COPY pom.xml .
# ---------------------------------
# Copies the .env file to the container
# ---------------------------------
COPY .env .env
# ---------------------------------
# Copies the project.properties file to the container
# ---------------------------------
COPY project.properties project.properties
# ---------------------------------
# Downloads Maven dependencies without running tests
# ---------------------------------
RUN mvn dependency:go-offline
# ---------------------------------
# Copies the source code files to the container
# ---------------------------------
COPY src ./src
# ---------------------------------
# Copies the sys folder and its contents to the container
# ---------------------------------
COPY sys ./sys
# ---------------------------------
# Gives execution permission to the callJavaFromDocker.sh script
# ---------------------------------
RUN chmod +x sys/callJavaFromDocker.sh
# ---------------------------------
# Step to install Maven dependencies and generate the JAR
# ---------------------------------
RUN mvn -B clean install -Pci-cd -DskipTests
# ---------------------------------
# Exposes ports
# ---------------------------------
EXPOSE 8080 1521 81
# ---------------------------------
# Command to start the callJavaFromDocker.sh script
# ---------------------------------
CMD ["./sys/callJavaFromDocker.sh"]