mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-04-24 19:32:48 +00:00
add test
This commit is contained in:
parent
332abbcb8a
commit
94e65b667f
4 changed files with 59 additions and 18 deletions
9
.dockerignore
Normal file
9
.dockerignore
Normal file
|
@ -0,0 +1,9 @@
|
|||
# exclude hidden dirs .git etc.
|
||||
.*
|
||||
*.iml
|
||||
gradle
|
||||
src
|
||||
# exclude build binaries
|
||||
build/*
|
||||
# except files for docker
|
||||
!build/docker
|
27
Dockerfile
Normal file
27
Dockerfile
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Example of custom Java runtime using jlink in a multi-stage container build
|
||||
FROM gradle:jdk21 as jdk-build
|
||||
|
||||
COPY --chown=gradle:gradle . /home/gradle/src
|
||||
WORKDIR /home/gradle/src
|
||||
RUN ls -al
|
||||
RUN gradle build -x test --no-daemon
|
||||
|
||||
# Create a custom Java runtime
|
||||
# RUN $JAVA_HOME/bin/jlink \
|
||||
# --add-modules java.base \
|
||||
# --strip-debug \
|
||||
# --no-man-pages \
|
||||
# --no-header-files \
|
||||
# --compress=2 \
|
||||
# --output /javaruntime
|
||||
|
||||
FROM openjdk:21
|
||||
EXPOSE 8080
|
||||
|
||||
RUN mkdir /app
|
||||
|
||||
# ENV SPRING_PROFILES_ACTIVE=dev
|
||||
|
||||
COPY --from=jdk-build /home/gradle/src/build/libs/*.jar /app/spring-boot-application.jar
|
||||
|
||||
ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-Djava.security.egd=file:/dev/./urandom","-jar","/app/spring-boot-application.jar", "$JAVA_OPTS"]
|
|
@ -1,21 +1,24 @@
|
|||
services:
|
||||
mysql:
|
||||
image: mysql:9.1
|
||||
ports:
|
||||
- "3306:3306"
|
||||
# postgres:
|
||||
# image: postgres:latest
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
# environment:
|
||||
# - POSTGRES_PASSWORD=petclinic
|
||||
# - POSTGRES_USER=petclinic
|
||||
# - POSTGRES_DB=petclinic
|
||||
petclinic:
|
||||
image: spring.petclinic:${CONTEINER_VESION}
|
||||
container_name: petclinic
|
||||
build: ./
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=
|
||||
- MYSQL_ALLOW_EMPTY_PASSWORD=true
|
||||
- MYSQL_USER=petclinic
|
||||
- MYSQL_PASSWORD=petclinic
|
||||
- MYSQL_DATABASE=petclinic
|
||||
volumes:
|
||||
- "./conf.d:/etc/mysql/conf.d:ro"
|
||||
postgres:
|
||||
image: postgres:17.0
|
||||
- SPRING_PROFILES_ACTIVE = ${SPRING_PROFILES_ACTIVE:-default}
|
||||
- SPRING_DATASOURCE_URL = ${SPRING_DATASOURCE_URL}
|
||||
- SPRING_DATASOURCE_USERNAME = ${SPRING_DATASOURCE_USERNAME}
|
||||
- SPRING_DATASOURCE_PASSWORD = ${SPRING_DATASOURCE_PASSWORD}
|
||||
- POSTGRES_URL = ${POSTGRES_URL}
|
||||
- POSTGRES_USER = ${POSTGRES_PASS}
|
||||
- POSTGRES_URL = ${POSTGRES_URL}
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=petclinic
|
||||
- POSTGRES_USER=petclinic
|
||||
- POSTGRES_DB=petclinic
|
||||
- "8080:8080"
|
||||
|
||||
|
|
2
envfile
Normal file
2
envfile
Normal file
|
@ -0,0 +1,2 @@
|
|||
SPRING_PROFILES_ACTIVE=default
|
||||
CONTEINER_VESION=latest
|
Loading…
Reference in a new issue