Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile build failed #2157

Open
3 tasks done
Iyarr opened this issue Oct 25, 2023 · 3 comments
Open
3 tasks done

Dockerfile build failed #2157

Iyarr opened this issue Oct 25, 2023 · 3 comments

Comments

@Iyarr
Copy link

Iyarr commented Oct 25, 2023

Expected Behavior

Build image from Dockerfile and run

Actual Behavior

Building the Dockerfile , it occur the error

=> ERROR [build 9/9] RUN ./gradlew shadowJar                                                                                                          0.3s 
------
 > [build 9/9] RUN ./gradlew shadowJar:
#0 0.332 /bin/sh: 1: ./gradlew: not found
------
Dockerfile:20
--------------------
  18 |         && apt install git -y
  19 |     RUN git submodule update --init
  20 | >>> RUN ./gradlew shadowJar
  21 |
  22 |     # Use OpenJDK JRE image for runtime
--------------------
ERROR: failed to solve: process "/bin/sh -c ./gradlew shadowJar" did not complete successfully: exit code: 127

Steps to Reproduce

Build image from Dockerfile by the command

docker build -t nukkit .

Debug information

  • Debug link:
  • Timings link (if relevant):

Crashdump, Backtrace or Other Files

Checklist:

  • [] I included a /debugpaste link
  • I made sure there aren't duplicates of this report (Use Search)
  • I made sure I am using an up-to-date version of Nukkit
  • I Made sure the bug/error is not caused by a plugin
@Iyarr Iyarr changed the title Dockerfile buid Dockerfile build failed Oct 25, 2023
@ApocalypsjeNL
Copy link
Member

Is the gradlew file present in your Nukkit directory, and has the file executable permission? (if it doesn't you can give them using chmod +x gradlew)

I tried to build the docker image using the same command you used and I cannot reproduce the issue

niek@BLAHAJ-ON-STEROIDS:~$ git clone https://github.com/CloudburstMC/Nukkit.git
Cloning into 'Nukkit'...
remote: Enumerating objects: 65259, done.
remote: Counting objects: 100% (889/889), done.
remote: Compressing objects: 100% (609/609), done.
remote: Total 65259 (delta 366), reused 560 (delta 219), pack-reused 64370
Receiving objects: 100% (65259/65259), 24.90 MiB | 6.86 MiB/s, done.
Resolving deltas: 100% (39116/39116), done.
niek@BLAHAJ-ON-STEROIDS:~$ cd Nukkit
niek@BLAHAJ-ON-STEROIDS:~/Nukkit$ /bin/sh -c ./gradlew
Starting a Gradle Daemon (subsequent builds will be faster)
<-------------> 0% INITIALIZING [958ms]
> Evaluating settings
^C
niek@BLAHAJ-ON-STEROIDS:~/Nukkit$ docker build -t nukkit .
[+] Building 118.8s (21/21) FINISHED                                                                                                                                                                                                         docker:default
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                   0.1s
 => => transferring dockerfile: 1.28kB                                                                                                                                                                                                                 0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                      0.1s
 => => transferring context: 55B                                                                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/openjdk:8-jre-slim                                                                                                                                                                                  2.4s
 => [internal] load metadata for docker.io/library/openjdk:8-jdk-slim                                                                                                                                                                                  2.4s
 => [build 1/9] FROM docker.io/library/openjdk:8-jdk-slim@sha256:19578a1e13b7a1e4cab9b227fb7b5d80e14665cf4024c6407d72ba89842a97ed                                                                                                                     18.4s
 => => resolve docker.io/library/openjdk:8-jdk-slim@sha256:19578a1e13b7a1e4cab9b227fb7b5d80e14665cf4024c6407d72ba89842a97ed                                                                                                                            0.0s
 => => sha256:19578a1e13b7a1e4cab9b227fb7b5d80e14665cf4024c6407d72ba89842a97ed 549B / 549B                                                                                                                                                             0.0s
 => => sha256:ecb89bb055c1ee4db9da38713b953f6daafefe575c77c6439eabbb85e3168402 1.16kB / 1.16kB                                                                                                                                                         0.0s
 => => sha256:80e75f92be33ca2bd4b933633dafc72aa82a34792f9b769063a474e97e163b8b 7.51kB / 7.51kB                                                                                                                                                         0.0s
 => => sha256:1efc276f4ff952c055dea726cfc96ec6a4fdb8b62d9eed816bd2b788f2860ad7 30.41MB / 31.37MB                                                                                                                                                     116.2s
 => => sha256:a2f2f93da48276873890ac821b3c991d53a7e864791aaf82c39b7863c908b93b 1.58MB / 1.58MB                                                                                                                                                         0.5s
 => => sha256:1a2de4cc94315f2ba5015e6781672aa8e0b1456a4d488694bb5f016d8f59fa70 210B / 210B                                                                                                                                                             0.2s
 => => sha256:9013b84ebbe7aec8b587e257266770d2ac6ec3fce4c27415e74fbaf5928b4549 106.19MB / 106.19MB                                                                                                                                                    16.4s
 => => extracting sha256:1efc276f4ff952c055dea726cfc96ec6a4fdb8b62d9eed816bd2b788f2860ad7                                                                                                                                                              2.5s
 => => extracting sha256:a2f2f93da48276873890ac821b3c991d53a7e864791aaf82c39b7863c908b93b                                                                                                                                                              0.2s
 => => extracting sha256:1a2de4cc94315f2ba5015e6781672aa8e0b1456a4d488694bb5f016d8f59fa70                                                                                                                                                              0.0s
 => => extracting sha256:9013b84ebbe7aec8b587e257266770d2ac6ec3fce4c27415e74fbaf5928b4549                                                                                                                                                              1.8s
 => [internal] load build context                                                                                                                                                                                                                      0.4s
 => => transferring context: 34.02MB                                                                                                                                                                                                                   0.3s
 => [run 1/6] FROM docker.io/library/openjdk:8-jre-slim@sha256:53186129237fbb8bc0a12dd36da6761f4c7a2a20233c20d4eb0d497e4045a4f5                                                                                                                       16.2s
 => => resolve docker.io/library/openjdk:8-jre-slim@sha256:53186129237fbb8bc0a12dd36da6761f4c7a2a20233c20d4eb0d497e4045a4f5                                                                                                                            0.0s
 => => sha256:85b121affeddcffc7bc6618140bb0285ad1257bd318676ddc67816863c0686c0 7.47kB / 7.47kB                                                                                                                                                         0.0s
 => => sha256:1efc276f4ff952c055dea726cfc96ec6a4fdb8b62d9eed816bd2b788f2860ad7 31.37MB / 31.37MB                                                                                                                                                      11.8s
 => => sha256:a2f2f93da48276873890ac821b3c991d53a7e864791aaf82c39b7863c908b93b 1.58MB / 1.58MB                                                                                                                                                         0.5s
 => => sha256:1a2de4cc94315f2ba5015e6781672aa8e0b1456a4d488694bb5f016d8f59fa70 210B / 210B                                                                                                                                                             0.2s
 => => sha256:53186129237fbb8bc0a12dd36da6761f4c7a2a20233c20d4eb0d497e4045a4f5 549B / 549B                                                                                                                                                             0.0s
 => => sha256:285c61a1e5e6b7b3709729b69558670148c5fdc6eb7104fae7dd370042c51430 1.16kB / 1.16kB                                                                                                                                                         0.0s
 => => sha256:d2421c7a4bbfc037d7fb487893cc5fe145e329dfb39b5ee6557016bf6c34072d 41.70MB / 41.70MB                                                                                                                                                      15.0s
 => => extracting sha256:1efc276f4ff952c055dea726cfc96ec6a4fdb8b62d9eed816bd2b788f2860ad7                                                                                                                                                            104.3s
 => => extracting sha256:a2f2f93da48276873890ac821b3c991d53a7e864791aaf82c39b7863c908b93b                                                                                                                                                              0.2s
 => => extracting sha256:d2421c7a4bbfc037d7fb487893cc5fe145e329dfb39b5ee6557016bf6c34072d                                                                                                                                                              1.0s
 => [build 2/9] WORKDIR /src                                                                                                                                                                                                                           0.2s
 => [build 3/9] COPY gradlew *.gradle.kts .gitmodules /src/                                                                                                                                                                                            0.1s
 => [build 4/9] COPY src /src/src                                                                                                                                                                                                                      0.2s
 => [build 5/9] COPY .git /src/.git                                                                                                                                                                                                                    0.1s
 => [build 6/9] COPY gradle /src/gradle                                                                                                                                                                                                                0.0s
 => [build 7/9] RUN apt-get clean     && apt-get update     && apt install git -y                                                                                                                                                                     14.5s
 => [build 8/9] RUN git submodule update --init                                                                                                                                                                                                        1.3s
 => [build 9/9] RUN ./gradlew shadowJar                                                                                                                                                                                                               79.2s
 => [run 2/6] COPY --from=build /src/target/nukkit-1.0-SNAPSHOT.jar /app/nukkit.jar                                                                                                                                                                    0.1s
 => [run 3/6] RUN useradd --user-group             --no-create-home             --home-dir /data             --shell /usr/sbin/nologin             minecraft                                                                                           0.6s
 => [run 4/6] RUN mkdir /data && mkdir /home/minecraft                                                                                                                                                                                                 0.5s
 => [run 5/6] RUN chown -R minecraft:minecraft /app /data /home/minecraft                                                                                                                                                                              0.6s
 => [run 6/6] WORKDIR /data                                                                                                                                                                                                                            0.0s
 => exporting to image                                                                                                                                                                                                                                 0.2s
 => => exporting layers                                                                                                                                                                                                                                0.2s
 => => writing image sha256:65b0561e92a5ebc1e66e4b7e9fe17e771b589f5f8177ee3b8a83909177c1309d                                                                                                                                                           0.0s
 => => naming to docker.io/library/nukkit                                                                                                                                                                                                              0.0s

What's Next?
  View a summary of image vulnerabilities and recommendations → docker scout quickview
niek@BLAHAJ-ON-STEROIDS:~/Nukkit$

@Iyarr
Copy link
Author

Iyarr commented Oct 25, 2023

I confirmed the gradlew file permission in my Nukkit directory

-rwxr-xr-x 1 root root 8739 Oct 24 18:06 gradlew

No ploblem

@Iyarr
Copy link
Author

Iyarr commented Oct 25, 2023

I executed the command by hands from Dockerfile , and it occured this error on execution at ./gradlew shadowJar

bash: ./gradlew: /bin/sh^M: bad interpreter: No such file or directory

I think it occured error by newline character on windows PC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants