R
Railway4mo ago
lotario

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!
Solution:
Try adding a chmod +x mvnw somewhere in your build process.
Jump to solution
9 Replies
Percy
Percy4mo ago
Project ID: fccc699b-2959-453f-9818-2fc046a08b12
lotario
lotario4mo ago
Brody
Brody4mo ago
@aleks - java time
root
root4mo ago
Are you developing this on Windows?
Solution
root
root4mo ago
Try adding a chmod +x mvnw somewhere in your build process.
lotario
lotario4mo ago
Yes I'm on Windows 11
root
root4mo ago
try this then
lotario
lotario4mo ago
That worked, thank you very much!