Failed to deploy ‘<unknown> Dockerfile: Dockerfile’: Image build failed with exit code 1

  docker, dockerfile, java, maven

I want to execute Java Maven Spring-boot application in a Docker environment. i tried many configurations but the error still says Failed to deploy <unknow> Dockerfile: Dockerfile':Image build failed with exit code 1
I don’t really understand what it means since barely start learning Docker
Here is my dockerfile script :

FROM maven:3.6.3-openjdk-11-slim as builder

ARG APP_ENV=uat
ARG MICROSERVICE_NAME

WORKDIR /app

# TODO: @EH think of a better way
COPY ./ ./

RUN mvn clean package -pl :${MICROSERVICE_NAME} -am -Dmaven.test.skip=true -P${APP_ENV}

FROM openjdk:11.0 as runner

WORKDIR /root/java_service

ARG APP_ENV=uat
ARG MICROSERVICE_NAME
ARG MICROSERVICE_BASE_PATH

RUN mkdir ${APP_ENV}
RUN mkdir logs

COPY --from=builder /app/${MICROSERVICE_BASE_PATH}/${MICROSERVICE_NAME}/target/${MICROSERVICE_NAME}.jar ${APP_ENV}/${MICROSERVICE_NAME}.jar

ENV APP_JAR_PATH=/root/java_service/${APP_ENV}/${MICROSERVICE_NAME}.jar

ENTRYPOINT java -server -jar ${APP_JAR_PATH}

Source: Docker Questions

LEAVE A COMMENT