-
Notifications
You must be signed in to change notification settings - Fork 19
/
Dockerfile.spring
34 lines (28 loc) · 1.3 KB
/
Dockerfile.spring
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
FROM openjdk:17.0.2
ARG RUN_JAVA_VERSION=1.3.8
ENV FLYWAY_VERSION 7.5.2
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
# Install java and the run-java script
# Also set up permissions for user `1001`
RUN microdnf update \
&& microdnf install curl ca-certificates tar gzip \
&& microdnf clean all \
&& mkdir /deployments \
&& mkdir /flyway \
&& chown 1001 /deployments \
&& chmod "g+rwX" /deployments \
&& chown 1001:root /deployments \
&& curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \
&& chown 1001 /deployments/run-java.sh \
&& chmod 540 /deployments/run-java.sh
# Install and configure Flyway
RUN curl https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/${FLYWAY_VERSION}/flyway-commandline-${FLYWAY_VERSION}.tar.gz -o /flyway/flyway-commandline-${FLYWAY_VERSION}.tar.gz \
&& tar -xzf /flyway/flyway-commandline-${FLYWAY_VERSION}.tar.gz --strip-components=1 -C /flyway \
&& rm /flyway/flyway-commandline-${FLYWAY_VERSION}.tar.gz \
&& chown 1001 /flyway/flyway \
&& chmod 540 /flyway/flyway
COPY app/spring-app/target/*.jar /deployments/app.jar
COPY resources/flyway/db/migration /flyway/sql
EXPOSE 8080
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]