I need to write a dockerfile that clones a repository from github and starts a simple Java server. Аm i moving in the right direction? please help
FROM alpine/git
WORKDIR /app
RUN git clone https://github.com/trekawek/jhttp.git
FROM maven:3.5-jdk-8-alpine
WORKDIR /app
COPY --from=0 /app/jhttp /app
RUN mvn install
FROM openjdk:8-jre-alpine
WORKDIR /app
COPY --from=1 /app/target/jhttp-0.0.1.jar /app
CMD ["java -jar jhttp-0.0.1.jar"]
You are heading in the right direction in creating a Dockerfile that builds a Docker image. The image needs to contain all the dependencies your application requires, including Java itself.
I recommend reading Dockers official documentation on Dockerfile:
The above links should provide enough information on creating a Dockerfile.