R
Railwayā€¢13mo ago
sarabwt

Java maven build fails

Nixpacks seems to be failing without running any of my build commands. Any help would be appreciated šŸ™‚
==============
context: 1889173e0899028c5062a0ec85f4ab12

ā•”ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• Nixpacks v1.17.0 ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•—
ā•‘ build ā”‚ mvn quarkus:build ā•‘
ā•‘ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā•‘
ā•‘ setup ā”‚ jdk17, maven ā•‘
ā•‘ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā•‘
ā•‘ start ā”‚ java -jar ./target/quarkus-app/quarkus-run.jar ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•


#0 building with "default" instance using docker driver

#1 [internal] load .dockerignore

#1 transferring context: 115B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.56kB done
#2 DONE 0.0s

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1695686596

#3 DONE 0.3s


#4 [stage-0 1/7] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1695686596@sha256:863c9103f1ec289f4d8d56a656945c673b2d580080b96738e966e52e49463387
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 2B done
#5 DONE 0.0s

#6 [stage-0 2/7] WORKDIR /app/
#6 CACHED

#7 [stage-0 3/7] COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix
#7 ERROR: failed to calculate checksum of ref 30c1c37f-83bb-4aca-810c-1086679cb0a8::e8fu6kipakixlxkca4jibanjr: failed to walk /var/lib/docker/tmp/buildkit-mount199857382/.nixpacks: lstat /var/lib/docker/tmp/buildkit-mount199857382/.nixpacks: no such file or directory
-----
> [stage-0 3/7] COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix:
-----

...

Error: Docker build failed
==============
context: 1889173e0899028c5062a0ec85f4ab12

ā•”ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• Nixpacks v1.17.0 ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•—
ā•‘ build ā”‚ mvn quarkus:build ā•‘
ā•‘ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā•‘
ā•‘ setup ā”‚ jdk17, maven ā•‘
ā•‘ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā•‘
ā•‘ start ā”‚ java -jar ./target/quarkus-app/quarkus-run.jar ā•‘
ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•


#0 building with "default" instance using docker driver

#1 [internal] load .dockerignore

#1 transferring context: 115B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 1.56kB done
#2 DONE 0.0s

#3 [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1695686596

#3 DONE 0.3s


#4 [stage-0 1/7] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1695686596@sha256:863c9103f1ec289f4d8d56a656945c673b2d580080b96738e966e52e49463387
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 2B done
#5 DONE 0.0s

#6 [stage-0 2/7] WORKDIR /app/
#6 CACHED

#7 [stage-0 3/7] COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix
#7 ERROR: failed to calculate checksum of ref 30c1c37f-83bb-4aca-810c-1086679cb0a8::e8fu6kipakixlxkca4jibanjr: failed to walk /var/lib/docker/tmp/buildkit-mount199857382/.nixpacks: lstat /var/lib/docker/tmp/buildkit-mount199857382/.nixpacks: no such file or directory
-----
> [stage-0 3/7] COPY .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix .nixpacks/nixpkgs-5148520bfab61f99fd25fb9ff7bfbb50dad3c9db.nix:
-----

...

Error: Docker build failed
Solution:
fuck me.... I was in the middle of writing that locally 1.18 and 1.10 both don't work (fail for that COPY .nixpacks/*), but do work if I run build in my subdirectory with package.json. I thought it had something to do with Java at first, but I have then seen that I have .dockerignore in my root šŸ¤¦ā€ā™‚ļø ``` * !target/-runner !target/-runner.jar...
Jump to solution
14 Replies
Percy
Percyā€¢13mo ago
Project ID: 30c1c37f-83bb-4aca-810c-1086679cb0a8
Brody
Brodyā€¢13mo ago
Brody
Brodyā€¢13mo ago
do you have a nixpacks.toml file?
sarabwt
sarabwtā€¢13mo ago
no
Brody
Brodyā€¢13mo ago
railway.json?
sarabwt
sarabwtā€¢13mo ago
nope
Brody
Brodyā€¢13mo ago
any kind of railway config or service variables that would modify the build
sarabwt
sarabwtā€¢13mo ago
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS"
},
"deploy": {
"numReplicas": 1,
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
This is the one that is suggested in the console, but I don't have any config in the repo. Also no variables. I'm trying to deploy a clean maven project.
Brody
Brodyā€¢13mo ago
okay then ill have to pull in the java expert @aleks - need help please šŸ™‚
sarabwt
sarabwtā€¢13mo ago
tnx
root
rootā€¢13mo ago
This seems almost like it might be running the steps in the wrong order - would you be able to install Nixpacks locally and run nixpacks plan, and paste the output here?
sarabwt
sarabwtā€¢13mo ago
{
"providers": [],
"buildImage": "ghcr.io/railwayapp/nixpacks:ubuntu-1697500996",
"variables": {
"NIXPACKS_METADATA": "java"
},
"phases": {
"build": {
"dependsOn": [
"install",
"setup"
],
"cmds": [
"mvn -DoutputFile=target/mvn-dependency-list.log -B -DskipTests clean dependency:list install"
],
"cacheDirectories": [
".m2/repository"
]
},
"setup": {
"nixPkgs": [
"jdk17",
"maven"
],
"nixOverlays": [],
"nixpkgsArchive": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db"
}
},
"start": {
"cmd": "java $JAVA_OPTS -jar target/*jar"
}
}
{
"providers": [],
"buildImage": "ghcr.io/railwayapp/nixpacks:ubuntu-1697500996",
"variables": {
"NIXPACKS_METADATA": "java"
},
"phases": {
"build": {
"dependsOn": [
"install",
"setup"
],
"cmds": [
"mvn -DoutputFile=target/mvn-dependency-list.log -B -DskipTests clean dependency:list install"
],
"cacheDirectories": [
".m2/repository"
]
},
"setup": {
"nixPkgs": [
"jdk17",
"maven"
],
"nixOverlays": [],
"nixpkgsArchive": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db"
}
},
"start": {
"cmd": "java $JAVA_OPTS -jar target/*jar"
}
}
Note that I have overriden the build and start command in the console. But the output was the same even before that. The build fails because that .nixpacks copy fails and the checksum cannot be calculated.
Solution
sarabwt
sarabwtā€¢13mo ago
fuck me.... I was in the middle of writing that locally 1.18 and 1.10 both don't work (fail for that COPY .nixpacks/*), but do work if I run build in my subdirectory with package.json. I thought it had something to do with Java at first, but I have then seen that I have .dockerignore in my root šŸ¤¦ā€ā™‚ļø
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
*
!target/*-runner
!target/*-runner.jar
!target/lib/*
!target/quarkus-app/*
Sorry for this time waste and thanks for the help!
Want results from more Discord servers?
Add your server