add configuration to use react-java-mysql sample with Docker Dev Environments feature
Signed-off-by: Guillaume Lours <guillaume.lours@docker.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# syntax=docker/dockerfile:1.4
|
||||
|
||||
FROM --platform=$BUILDPLATFORM maven:3.8.5-eclipse-temurin-17 AS builder
|
||||
WORKDIR /workdir/server
|
||||
COPY pom.xml /workdir/server/pom.xml
|
||||
@@ -5,6 +7,24 @@ RUN mvn dependency:go-offline
|
||||
|
||||
COPY src /workdir/server/src
|
||||
RUN mvn install
|
||||
|
||||
FROM builder as dev-envs
|
||||
|
||||
RUN <<EOF
|
||||
apt-get update
|
||||
apt-get install -y git
|
||||
EOF
|
||||
|
||||
RUN <<EOF
|
||||
useradd -s /bin/bash -m vscode
|
||||
groupadd docker
|
||||
usermod -aG docker vscode
|
||||
EOF
|
||||
# install Docker tools (cli, buildx, compose)
|
||||
COPY --from=gloursdocker/docker / /
|
||||
CMD ["mvn", "spring-boot:run"]
|
||||
|
||||
FROM builder as prepare-production
|
||||
RUN mkdir -p target/dependency
|
||||
WORKDIR /workdir/server/target/dependency
|
||||
RUN jar -xf ../*.jar
|
||||
@@ -14,7 +34,7 @@ FROM eclipse-temurin:17-jre-focal
|
||||
EXPOSE 8080
|
||||
VOLUME /tmp
|
||||
ARG DEPENDENCY=/workdir/server/target/dependency
|
||||
COPY --from=builder ${DEPENDENCY}/BOOT-INF/lib /app/lib
|
||||
COPY --from=builder ${DEPENDENCY}/META-INF /app/META-INF
|
||||
COPY --from=builder ${DEPENDENCY}/BOOT-INF/classes /app
|
||||
COPY --from=prepare-production ${DEPENDENCY}/BOOT-INF/lib /app/lib
|
||||
COPY --from=prepare-production ${DEPENDENCY}/META-INF /app/META-INF
|
||||
COPY --from=prepare-production ${DEPENDENCY}/BOOT-INF/classes /app
|
||||
ENTRYPOINT ["java","-cp","app:app/lib/*","com.company.project.Application"]
|
@@ -41,10 +41,6 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
|
Reference in New Issue
Block a user