-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathDockerfile
89 lines (60 loc) · 1.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
89
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) target/*
# See the main README.md file for instructions on compiling. The compiled version is placed
# into the target directory by default.
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Compile code:
# $ mvn install
# Build Docker Image:
# $ docker build -t {tag} .
#
# Pull base image
# ---------------
ARG MAVEN_VERSION=3.9.9
ARG BASE_REGISTRY=registry.access.redhat.com/ubi8
ARG BASE_IMAGE=ubi-minimal
ARG JAVA_OPT="-XX:UseSVE=0"
FROM docker.io/library/maven:${MAVEN_VERSION} AS builder
LABEL stage=pgcomparebuilder
ARG JAVA_OPT
ENV _JAVA_OPTIONS=${JAVA_OPT}
WORKDIR /app
COPY . ./
RUN mvn clean install
FROM ${BASE_REGISTRY}/${BASE_IMAGE} as multi-stage
ARG JAVA_OPT
RUN microdnf install java-21-openjdk -y
USER 0
RUN mkdir /opt/pgcompare \
&& chown -R 1001:1001 /opt/pgcompare
COPY --from=builder /app/docker/start.sh /opt/pgcompare
COPY --from=builder /app/docker/pgcompare.properties /etc/pgcompare/
COPY --from=builder /app/target/* /opt/pgcompare/
RUN chmod 770 /opt/pgcompare/start.sh
USER 1001
ENV PGCOMPARE_HOME=/opt/pgcompare \
PGCOMPARE_CONFIG=/etc/pgcompare/pgcompare.properties \
PATH=/opt/pgcompare:$PATH \
_JAVA_OPTIONS=${JAVA_OPT}
CMD ["start.sh"]
WORKDIR "/opt/pgcompare"
## Local Platform Build
FROM ${BASE_REGISTRY}/${BASE_IMAGE} as local
RUN microdnf install java-21-openjdk -y
USER 0
RUN mkdir /opt/pgcompare \
&& chown -R 1001:1001 /opt/pgcompare
COPY docker/start.sh /opt/pgcompare/
COPY docker/pgcompare.properties /etc/pgcompare/
COPY target/* /opt/pgcompare/
RUN chmod 770 /opt/pgcompare/start.sh
USER 1001
ENV PGCOMPARE_HOME=/opt/pgcompare \
PGCOMPARE_CONFIG=/etc/pgcompare/pgcompare.properties \
PATH=/opt/pgcompare:$PATH \
_JAVA_OPTIONS=${JAVA_OPT}
CMD ["start.sh"]
WORKDIR "/opt/pgcompare"