fix: Dockerfile → COPY pre-built binary (no network needed)
CI / test (push) Successful in 2m45s

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:
2026-08-03 20:26:02 -04:00
parent 35a79f1d5b
commit 1c847a824d
2 changed files with 15 additions and 25 deletions
+5 -11
View File
@@ -1,17 +1,11 @@
# ── Build: use official V container to compile ──────────────────────────── # ── Minimal Docker image for ntfy-bridge ──────────────────────────────────
FROM thevlang/vlang:alpine AS builder # Binary is built on the host: v -os linux -o ntfy-bridge .
# Copy project source and build
WORKDIR /src
COPY . .
RUN git clone https://github.com/vlang/yaml.git /root/.vmodules/yaml
RUN v -prod -o /ntfy-bridge .
# ── Runtime: minimal image ────────────────────────────────────────────────
FROM alpine:3.20 FROM alpine:3.20
RUN apk add --no-cache ca-certificates tzdata curl RUN apk add --no-cache ca-certificates tzdata curl
COPY --from=builder /ntfy-bridge /usr/local/bin/ntfy-bridge
COPY ntfy-bridge /usr/local/bin/ntfy-bridge
RUN chmod +x /usr/local/bin/ntfy-bridge
WORKDIR /etc/ntfy-bridge WORKDIR /etc/ntfy-bridge
EXPOSE 9090 EXPOSE 9090
+10 -14
View File
@@ -50,24 +50,20 @@ state:
println(' Wrote: ${target_dir}/dashboard.html') println(' Wrote: ${target_dir}/dashboard.html')
} }
// Copy Dockerfile and sources for build // Copy Dockerfile and build Linux binary
if os.exists('Dockerfile') { if os.exists('Dockerfile') {
os.cp('Dockerfile', '${target_dir}/Dockerfile') or {} os.cp('Dockerfile', '${target_dir}/Dockerfile') or {}
println(' Wrote: ${target_dir}/Dockerfile') println(' Wrote: ${target_dir}/Dockerfile')
} }
// Copy V source files // Cross-compile Linux binary
src_files := ['main.v', 'server.v', 'config.v', 'log.v', 'ntfy.v', 'dedup.v', println(' Building Linux binary (v -os linux)...')
'docker_watcher.v', 'service.v', 'filter_outgoing.v', 'metrics.v', build_result := os.execute('v -os linux -o ${target_dir}/ntfy-bridge .')
'docker_install.v', 'v.mod', 'dashboard.html', 'ntfy-bridge.example.yaml', if build_result.exit_code != 0 {
'sources/event.v', 'sources/gitea.v', 'sources/uptime_kuma.v', println(' Warning: Could not cross-compile Linux binary.')
'sources/docker.v', 'sources/generic.v', 'sources/cron.v', println(' ${build_result.output}')
'sources/http_poll.v'] println(' You will need a Linux binary named "ntfy-bridge" in ${target_dir}/')
for file in src_files { } else {
if os.exists(file) { println(' Built: ${target_dir}/ntfy-bridge')
target := '${target_dir}/${file}'
os.mkdir_all(os.dir(target)) or {}
os.cp(file, target) or {}
}
} }
// docker-compose.yml // docker-compose.yml