docker compose config (now 100% more postgres compatible)

This commit is contained in:
GasparAM 2023-04-11 15:51:55 +04:00
parent ba1fbbf0e5
commit fe7cc235b6
2 changed files with 6 additions and 12 deletions

View file

@ -16,9 +16,9 @@ COPY ./ ./
RUN ./mvnw clean ; ./mvnw package RUN ./mvnw clean ; ./mvnw package
FROM alpine:latest FROM alpine:latest
ENV JAR=spring-petclinic-3.0.3.jar ENV DB=
RUN apk --no-cache add openjdk17-jre-headless RUN apk --no-cache add openjdk17-jre-headless
WORKDIR /home WORKDIR /home
COPY --from=builder /tmp/target/spring-*.jar ./ COPY --from=builder /tmp/target/spring-*.jar ./
EXPOSE 8080 EXPOSE 8080
CMD ["/bin/sh", "-c", "/usr/bin/java -jar /home/spring-*.jar"] CMD ["/bin/sh", "-c", "/usr/bin/java -jar /home/spring-*.jar ${DB}"]

View file

@ -1,18 +1,12 @@
version: "2.2" version: "2.2"
services: services:
mysql: spring-petclinic:
image: mysql:8.0 build: ./
ports: ports:
- "3306:3306" - "8080:8080"
environment: environment:
- MYSQL_ROOT_PASSWORD= - DB="--spring.profiles.active=postgres"
- MYSQL_ALLOW_EMPTY_PASSWORD=true
- MYSQL_USER=petclinic
- MYSQL_PASSWORD=petclinic
- MYSQL_DATABASE=petclinic
volumes:
- "./conf.d:/etc/mysql/conf.d:ro"
postgres: postgres:
image: postgres:15.2 image: postgres:15.2
ports: ports: