multi-stage docker build starting on last stage

I've got a Java Spring server I'm trying to deploy with a docker file which builds and runs the jar file. I can build the image without issue on my machine but when railway goes build it, it starts on the second FROM
FROM gradle:latest AS BUILD
WORKDIR /usr/app/
COPY . .
RUN gradle build
RUN echo $(ls)

FROM eclipse-temurin:17-jdk-alpine
ARG JAR_FILE=target/*.jar
RUN touch .env
RUN echo $(ls)
COPY ./build/libs/*.jar app.jar
RUN echo $(ls)
ENTRYPOINT ["java","-jar","/app.jar"]
EXPOSE 8080
FROM gradle:latest AS BUILD
WORKDIR /usr/app/
COPY . .
RUN gradle build
RUN echo $(ls)

FROM eclipse-temurin:17-jdk-alpine
ARG JAR_FILE=target/*.jar
RUN touch .env
RUN echo $(ls)
COPY ./build/libs/*.jar app.jar
RUN echo $(ls)
ENTRYPOINT ["java","-jar","/app.jar"]
EXPOSE 8080
3 Replies
Percy
Percy2y ago
Project ID: ea0de175-cc8a-4f11-b3ec-ed6f504d742a
deazee
deazeeOP2y ago
ea0de175-cc8a-4f11-b3ec-ed6f504d742a
jr
jr17mo ago
Hi Deazee, I can't see any service that uses a Dockerfile in that project. However, what you might be seeing is Docker building each stage concurrently and the logs are just interleaved
Want results from more Discord servers?
Add your server