Hello, please help, I deployed ktor project to doc...
# getting-started
a
Hello, please help, I deployed ktor project to docker using this
Dockerfile
but when I try to upload image and read file I’m getting error of
file or directory not found
BUT in reality the directory exist or file do exist
Copy code
# Use the official gradle image to create a build artifact.
FROM gradle:7-jdk11 as builder

# Copy local code to the container image.
COPY build.gradle.kts .
COPY gradle.properties .
COPY src ./src
COPY uploads ./uploads


# Build a release artifact.
RUN gradle installDist

FROM openjdk:11
EXPOSE 7002:7002
RUN mkdir /app
COPY --from=builder /home/gradle/build/install/gradle /app/
WORKDIR /app/bin
CMD ["./gradle"]
c
should that CMD perhaps be
./gradlew
?
which file/directory is purported to not exist?
a
It's works with
.gradle
uploads
inside the root folder
c
could you share the log output showing the progress through this & the error?
a
sure
Copy code
2022-12-29 11:13:31.611 [eventLoopGroupProxy-4-2] DEBUG ktor.application - Unhandled: POST - /dashboard/profile/update. Exception class java.io.FileNotFoundException: uploads/Rlmdw31o9PDkeconaUCxD4k3eiz5ZX.png (No such file or directory)]
java.io.FileNotFoundException: uploads/Rlmdw31o9PDkeconaUCxD4k3eiz5ZX.png (No such file or directory)
This is when I want upload a file to the
uploads
directory
c
it looks like the server handling that POST is using a relative directory
uploads
- generally cleanest to configure with an absolute path to avoid issues like this, where the working directory isn’t that is expected.
a
Ohk so how can I fix the issue, please?
c
as suggested. either reconfigure your code to use an absolute directory, or change the working directory.
a
Reconfigure the
Dockerfile
?