Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multistage dockerFile #1733

Open
bramlihamza opened this issue Aug 30, 2022 · 0 comments · May be fixed by #1734
Open

Multistage dockerFile #1733

bramlihamza opened this issue Aug 30, 2022 · 0 comments · May be fixed by #1734

Comments

@bramlihamza
Copy link

Hi, thank you for the fast response.

I want to reproduce some think like this .

# First stage:  **build environment**
FROM maven:3.5.0-jdk-8-alpine **AS builder**

# add pom.xml and source code
ADD ./pom.xml pom.xml
ADD ./src src/

# package jar
RUN mvn clean package

# Second **stage: minimal runtime environment**
From openjdk:8-jre-alpine

# copy jar from the first stage
COPY **--from=builder** target/my-app-1.0-SNAPSHOT.jar my-app-1.0-SNAPSHOT.jar

EXPOSE 8080

CMD ["java", "-jar", "my-app-1.0-SNAPSHOT.jar"]

So I want to create a first stage to build the project, then create a second stage to copy the artifact from the first stage and run it.

I tried to do this, but I was blocked in the second stage.

 new DockerFileBuilder()
        .basedir("/")
        .baseImage("**maven:3.5.0-jdk-8-alpine** ### **AS** **builder**")
        .expose(Collections.singletonList("8080"))
			/////
			/////
        .entryPoint(a)
        
        
        .write(javaProject.getWorkDir().toFile());

thank you .

Originally posted by @bramlihamza in #1708 (reply in thread)

bramlihamza added a commit to bramlihamza/jkube that referenced this issue Aug 30, 2022
Signed-off-by Bramli Hamza <hamza_bramli@outlook.fr>
@rohanKanojia rohanKanojia linked a pull request Sep 2, 2022 that will close this issue
15 tasks
rohanKanojia pushed a commit to bramlihamza/jkube that referenced this issue Sep 6, 2022
Signed-off-by Bramli Hamza <hamza_bramli@outlook.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant