Skip to content

Commit 54fb84d

Browse files
committed
build: refactor build steps and update GeoIP2 database integration
- Remove the `xcaddy` build step. - Add a `go-task` build step. - Change the way the GeoIP2 database is copied and used. - Update `Caddyfile` to use the new path to GeoIP2 database. Signed-off-by: ysicing <i@ysicing.me>
1 parent fe375dd commit 54fb84d

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

Dockerfile

+4-8
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,21 @@ FROM ysicing/god as builder
22

33
RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
44

5+
RUN go install github.com/go-task/task/v3/cmd/task@latest
6+
57
WORKDIR /go/src/github.com/ysicing/caddy2-geocn
68

79
COPY . .
810

9-
RUN xcaddy build --with github.com/ysicing/caddy2-geocn=../caddy2-geocn
10-
11-
FROM ysicing/debian as geoip
12-
13-
WORKDIR /root
14-
15-
RUN wget https://github.com/Hackl0us/GeoIP2-CN/raw/release/Country.mmdb
11+
RUN task build
1612

1713
FROM ysicing/debian
1814

1915
COPY docker /etc/caddy
2016

2117
COPY --from=builder /go/src/github.com/ysicing/caddy2-geocn/caddy /usr/local/bin/caddy
2218

23-
COPY --from=geoip /root/Country.mmdb /etc/caddy/Country.mmdb
19+
COPY --from=builder /go/src/github.com/ysicing/caddy2-geocn/Country.mmdb /etc/caddy/Country.mmdb
2420

2521
RUN chmod +x /usr/local/bin/caddy && \
2622
mkdir -p \

docker/Caddyfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
metrics /metrics
2626
@geofilter {
2727
geocn {
28-
db_file "/etc/caddy/Country.mmdb"
28+
geolocal "/etc/caddy/Country.mmdb"
2929
}
3030
}
3131
file_server @geofilter {
@@ -34,4 +34,4 @@
3434
file_server {
3535
root /etc/caddy/example/allow
3636
}
37-
}
37+
}

0 commit comments

Comments
 (0)