Docker Desktop Windows blocks build network access. Instead of building V from source inside Docker, cross-compile Linux binary on host and COPY into minimal alpine image.
This commit is contained in:
+10
-14
@@ -50,24 +50,20 @@ state:
|
||||
println(' Wrote: ${target_dir}/dashboard.html')
|
||||
}
|
||||
|
||||
// Copy Dockerfile and sources for build
|
||||
// Copy Dockerfile and build Linux binary
|
||||
if os.exists('Dockerfile') {
|
||||
os.cp('Dockerfile', '${target_dir}/Dockerfile') or {}
|
||||
println(' Wrote: ${target_dir}/Dockerfile')
|
||||
}
|
||||
// Copy V source files
|
||||
src_files := ['main.v', 'server.v', 'config.v', 'log.v', 'ntfy.v', 'dedup.v',
|
||||
'docker_watcher.v', 'service.v', 'filter_outgoing.v', 'metrics.v',
|
||||
'docker_install.v', 'v.mod', 'dashboard.html', 'ntfy-bridge.example.yaml',
|
||||
'sources/event.v', 'sources/gitea.v', 'sources/uptime_kuma.v',
|
||||
'sources/docker.v', 'sources/generic.v', 'sources/cron.v',
|
||||
'sources/http_poll.v']
|
||||
for file in src_files {
|
||||
if os.exists(file) {
|
||||
target := '${target_dir}/${file}'
|
||||
os.mkdir_all(os.dir(target)) or {}
|
||||
os.cp(file, target) or {}
|
||||
}
|
||||
// Cross-compile Linux binary
|
||||
println(' Building Linux binary (v -os linux)...')
|
||||
build_result := os.execute('v -os linux -o ${target_dir}/ntfy-bridge .')
|
||||
if build_result.exit_code != 0 {
|
||||
println(' Warning: Could not cross-compile Linux binary.')
|
||||
println(' ${build_result.output}')
|
||||
println(' You will need a Linux binary named "ntfy-bridge" in ${target_dir}/')
|
||||
} else {
|
||||
println(' Built: ${target_dir}/ntfy-bridge')
|
||||
}
|
||||
|
||||
// docker-compose.yml
|
||||
|
||||
Reference in New Issue
Block a user