Dockerfile deployment fails
Hello.
To deploy a Java 21 app I'm using a dockerfile posted by another Railway user for the same purpose (I've only added my own variables):
FROM eclipse-temurin:21-jdk as build
COPY . /app
WORKDIR /app
RUN ./mvnw clean package -DskipTests
RUN mv -f target/.jar app.jar
FROM eclipse-temurin:21-jre
ARG DATABASE_URL
ARG DATABASE_USERNAME
ARG DATABASE_PASSWORD
ARG PORT
ENV PORT=${PORT}
COPY --from=build /app/app.jar .
RUN useradd runtime
USER runtime
ENTRYPOINT [ "java", "-Dserver.port=${PORT}", "-jar", "app.jar" ]
The error in the logs is:
#10 [build 4/5] RUN ./mvnw clean package -DskipTests
#10 0.263 /bin/sh: 1: ./mvnw: Permission denied
#10 ERROR: process "/bin/sh -c ./mvnw clean package -DskipTests" did not complete successfully: exit code: 126
-----
[build 4/5] RUN ./mvnw clean package -DskipTests:0.263 /bin/sh: 1: ./mvnw: Permission denied ----- Dockerfile:4 ------------------- 2 | COPY . /app 3 | WORKDIR /app 4 | >>> RUN ./mvnw clean package -DskipTests 5 | RUN mv -f target/.jar app.jar 6 | ------------------- ERROR: failed to solve: process "/bin/sh -c ./mvnw clean package -DskipTests" did not complete successfully: exit code: 126 Project ID: fccc699b-2959-453f-9818-2fc046a08b12 I don't know where to go from here, any help is appreciated! Thanks!
9 Replies
Project ID:
fccc699b-2959-453f-9818-2fc046a08b12
build logs please https://bookmarklets.up.railway.app/log-downloader/
Here they are
@aleks - java time
Are you developing this on Windows?
Solution
Try adding a
chmod +x mvnw
somewhere in your build process.Yes I'm on Windows 11
try this then
That worked, thank you very much!