deazee
deazee
RRailway
Created by deazee on 7/9/2023 in #✋|help
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
5 replies