Hokkaydo / EPLBot

EPLBot sources repository
https://discord.gg/9wKTDtPbvm
GNU General Public License v3.0
7 stars 6 forks source link

FIX: dockerfile #49

Closed tdaron closed 10 months ago

tdaron commented 10 months ago

Dockerfile from master was not building, so i managed to make it work and added a how-to inside of README.

I think there might be a proper way to do that, but it currently works nice as it is !

Hokkaydo commented 10 months ago

What was the problem? Currently, the bot is running an image build using the dev's branch Dockerfile and I don't have any problems building it

tdaron commented 10 months ago

The build only works if you already built the project one time on your machine, otherwise you get this error:

❯ docker build .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  58.17MB
Step 1/6 : FROM eclipse-temurin:19-jdk-jammy
 ---> f546b418bb3a
Step 2/6 : LABEL authors="hokkaydo"
 ---> Using cache
 ---> a35f33a6ab15
Step 3/6 : CMD ["gradlew", "shadowJar"]
 ---> Using cache
 ---> 5fb159fcab28
Step 4/6 : COPY build/libs/EPLBot-1.0-SNAPSHOT-all.jar /home/eplbot/eplbot.jar
COPY failed: file not found in build context or excluded by .dockerignore: stat build/libs/EPLBot-1.0-SNAPSHOT-all.jar: file does not exist

because build/libs does not exist in the docker nor in your machine. On my Dockerfile version, i am building the project inside the docker (which means user does not have to have java installed to build the docker)

to reproduce, just try to clone your repo in a new dir and directly build the docker

Your CMD ["gradlew", "shadowJar"] does not do anything, try removing it and it does not change everything at all :(

And there also is no persistence folder created inside the docker, which means that even after building the image using the jar on my machine, i get an error because persistence folder does not exists

Hokkaydo commented 10 months ago

Indeed you're right I didn't see that coming

tdaron commented 10 months ago

Quick typos

already fixed :D

Hokkaydo commented 10 months ago

Lgtm