Код: Выделить всё
public File convert(MultipartFile multipartFile) {
byte[] bytes;
try {
bytes = multipartFile.getBytes();
try (FileOutputStream fos = new FileOutputStream("files/" + multipartFile.getOriginalFilename())) {
fos.write(bytes);
}
} catch(IOException e) {
System.out.println("Exception when converting multipart file to array of bytes");
System.out.println(e.getCause());
System.out.println(e.getMessage());
}
return new File("files/" + multipartFile.getOriginalFilename());
}
Код: Выделить всё
file-exchange-web-1 | Exception when converting multipart file to array of bytes
file-exchange-web-1 | null
file-exchange-web-1 | files/zip.png (No such file or directory)
Код: Выделить всё
file-exchange-web-1 | java.io.FileNotFoundException: file [/apps/files/zip.png] cannot be resolved in the file system for checking its content length
Код: Выделить всё
FROM openjdk:21-slim
WORKDIR /apps
ARG JAR_FILE
COPY target/${JAR_FILE} /apps/app.jar
COPY /entrypoint.sh /apps/entrypoint.sh
RUN adduser --system servuser
RUN chmod +x /apps/entrypoint.sh
RUN chown -R servuser /apps
USER servuser
EXPOSE 8080 8080
CMD ["/apps/entrypoint.sh"]
Я погуглил концепцию точных каталогов, докер помещает приложение в контейнер, но на самом деле ничего не нашел это могло бы мне помочь.
Подробнее здесь: https://stackoverflow.com/questions/787 ... -messed-up