Hi, I’m trying to build an image of the frontend. ...
# troubleshoot
b
Hi, I’m trying to build an image of the frontend. In the root of the project I’m running
docker build -t data-catalog-frontend:0.1 -f docker/datahub-frontend/Dockerfile .
However I’m getting (in the thread)
👀 1
✅ 2
Copy code
[+] Building 3.5s (8/14)
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                       0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                          0.0s
 => => transferring context: 35B                                                                                                                                                                                                                                           0.0s
 => [internal] load metadata for <http://docker.io/library/alpine:3|docker.io/library/alpine:3>                                                                                                                                                                                                                3.0s
 => CACHED [base 1/3] FROM <http://docker.io/library/alpine:3@sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a|docker.io/library/alpine:3@sha256:f271e74b17ced29b915d351685fd4644785c6d1559dd1f2d4189a5e851ef753a>                                                                                                                                              0.0s
 => [internal] load build context                                                                                                                                                                                                                                          0.0s
 => => transferring context: 226B                                                                                                                                                                                                                                          0.0s
 => CANCELED [base 2/3] RUN addgroup -S datahub && adduser -S datahub -G datahub                                                                                                                                                                                           0.5s
 => CACHED [base 3/3] RUN apk --no-cache --update-cache --available upgrade     && apk --no-cache add curl     && apk --no-cache add openjdk11-jre --repository=<http://dl-cdn.alpinelinux.org/alpine/edge/community>                                                        0.0s
 => ERROR [prod-install 1/5] COPY ./datahub-frontend.zip /                                                                                                                                                                                                                 0.0s
------
 > [prod-install 1/5] COPY ./datahub-frontend.zip /:
------
failed to compute cache key: "/datahub-frontend.zip" not found: not found
I’ve ran a Gradle build for the frontend, so I’m not sure why the error is happening - am I missing something? Thanks
i
Hello Glenn, Have you compiled DataHub prior to trying to build the image?
b
Hi Pedro, thanks for picking this up. I have complied the frontend with
./gradlew :datahub-frontend:dist -x yarnTest -x yarnLint
as it’s only a frontend image I want to build.
I was able to build the image fine previously with the docker build command. It looks like the Dockerfile was refactored two weeks ago that changed how the image was build https://github.com/datahub-project/datahub/commit/ecc01b9a46c8c8ba970f55ec46872468e038a9ef#diff-5de6648b595eee76527ccc[…]b50feab9695a94b98b53f1342d3
i
Yes, the dockerfiles now expect the project to be compiled before building the image. This was done so that compilation was done by the host OS and not on a docker container which for multi-platform builds would be very slow and redundant.
b
Ah I see, so should compilation be doing that now or is that still to be added? I can just checkout a specific tag rather than from master as it currently is.
i
You need to explicitly compile DataHub before building the dockerfile. In the past the dockerfile built datahub but now it doesn't.
b
Right, and that’s done with Gradle?
i
Yes
b
Ok, but what I’m finding is that running
./gradlew :datahub-frontend:dist -x yarnTest -x yarnLint
from an up to date master does not put datahub-frontend.zip where it needs to be for the docker build. In fact, it doesn’t create the zip file at all - hence the original error.
I rolled back and checked out the 0.9.5 tag and
./gradlew :datahub-frontend:dist -x yarnTest -x yarnLint
does create the zip file
Which is why I thought that there might be ongoing work in the build code to address this in light of the docker build now not compiling
i
You should be able to run the
docker
gradle task from datahub-frontend module:
./gradlew :datahub-frontend
, that should compile the project and create the docker image locally
b
Ok, I’ll give that a go - thanks for your help Pedro!
m
@bumpy-manchester-97826 did the `./gradlew datahub frontenddocker`work for you ? I get the below error
Copy code
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':li-utils:compileMainGeneratedDataTemplateJava'.
> Could not find tools.jar. Please check that /usr/lib/jvm/java-8-openjdk-amd64 contains a valid JDK installation.
my env variable
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
b
I don’t remember is the honest answer, but I don’t recall having any issues like you posted. Is that definitely where your jdk is installed?