Skip to content

Commit

Permalink
fix: fixing datasource for MultiFlywayConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj committed Oct 25, 2024
1 parent 3460063 commit d5916cd
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
### Builder
FROM ghcr.io/graalvm/native-image:22.3.3 AS build
FROM eclipse-temurin:17.0.8.1_1-jdk-jammy AS build

# Install Maven
RUN apt update -y && \
apt install -y wget tar && \
wget https://archive.apache.org/dist/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz && \
tar xzf apache-maven-3.8.6-bin.tar.gz -C /opt && \
ln -s /opt/apache-maven-3.8.6 /opt/maven && \
ln -s /opt/maven/bin/mvn /usr/bin/mvn && \
rm apache-maven-3.8.6-bin.tar.gz && \
apt-get clean

# Add Maven to the PATH environment variable
ENV MAVEN_HOME=/opt/maven
ENV PATH=$MAVEN_HOME/bin:$PATH

# Receiving app version
ARG APP_VERSION=0.0.1

# Copy
WORKDIR /app
COPY pom.xml mvnw ./
COPY pom.xml ./
COPY src ./src
COPY .mvn/ ./.mvn
COPY InstallCert.java .

# Build
RUN ./mvnw package -Pnative -DskipTests -Dskip.unit.tests=true -Dspring-boot.run.profiles=prod
RUN mvn clean package -DskipTests -Dtests.skip=true -Dskip.unit.tests=true

### Deployer
FROM eclipse-temurin:17.0.12_7-jdk-jammy AS deploy
FROM eclipse-temurin:17.0.8.1_1-jre-jammy AS deploy
ARG PORT=3100

# Copy
WORKDIR /app
COPY --from=build /app/target/*.jar /app/*.class ./artifacts/
COPY dockerfile-entrypoint.sh ./
RUN mkdir config dump public && \
chmod -R g+w . && \
chmod g+x dockerfile-entrypoint.sh && \
chmod g+w ${JAVA_HOME}/lib/security/cacerts

# Port and health check
COPY --from=build /app/target/nr-results-backend.jar ./nr-results-backend.jar

# User, port and health check
USER 1001
EXPOSE 8080
HEALTHCHECK CMD curl -f http://localhost:8080/actuator/health | grep '"status":"UP"'
EXPOSE ${PORT}
HEALTHCHECK CMD curl -f http://localhost:${PORT}/actuator/health | grep '"status":"UP"'

# Startup
ENTRYPOINT ["/app/dockerfile-entrypoint.sh"]
ENTRYPOINT ["java", "-jar","/app/nr-results-backend.jar","--spring.profiles.active=prod"]

0 comments on commit d5916cd

Please sign in to comment.