docs: add minimal Alpine gpclient image

This commit is contained in:
Kevin Yue committed 2026-05-09 09:04:28 +08:00
1 parent 4d252fa31c
commit 6f91a79081
4 files changed
+96 -2

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
.build
.git
.vendor
apps/gpgui-helper/node_modules
target
vendor.tar.xz
+21 -1
View File
@@ -197,6 +197,26 @@ sudo apk add --allow-untrusted globalprotect-openconnect-*.apk
The package uses Alpine's native musl build. Make sure the `community` repository is enabled so GUI dependencies such as `webkit2gtk-4.1`, `libsecret`, and `libayatana-appindicator` can be resolved. GUI-launched connections use polkit, and VPN tunnel creation requires `/dev/net/tun`.
#### Minimal CLI Docker Image
For a container that only needs `gpclient`, build the Alpine CLI image from source:
```bash
git clone https://github.com/yuezk/GlobalProtect-openconnect.git
cd GlobalProtect-openconnect
git submodule update --init --recursive
docker build -f packaging/docker/cli-alpine/Dockerfile -t gpclient-alpine .
```
Run it with access to the TUN device:
```bash
docker run --rm -it --cap-add=NET_ADMIN --device=/dev/net/tun gpclient-alpine \
connect <portal> --cookie-on-stdin
```
The image uses `BUILD_GUI_HELPER=0` and `INCLUDE_GUI=0`, so it does not build or install `gpgui-helper` or `gpgui`.
### Gentoo
Available via the `guru` and `lamdness` overlays:
@@ -318,7 +338,7 @@ This project includes a DevContainer configuration that provides a consistent, r
--tty -v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \
bash -c "export PATH=/usr/local/cargo/bin:\$PATH && make build"
```
To build without the GUI helper run the same command as above, but with `BUILD_GUI=0` passed as an argument to `make`.
To build without the GUI helper run the same command as above, but with `BUILD_GUI_HELPER=0` passed as an argument to `make`.
5. **Locate build artifacts:**
+9 -1
View File
@@ -540,7 +540,15 @@ impl<'a> ConnectHandler<'a> {
match prelogin {
Prelogin::Saml(prelogin) => {
let browser = if prelogin.support_default_browser() {
self.args.browser.as_deref()
#[cfg(feature = "webview-auth")]
{
self.args.browser.as_deref()
}
#[cfg(not(feature = "webview-auth"))]
{
None
}
} else if !cfg!(feature = "webview-auth") {
bail!(
"The server does not support authentication via the default browser and the gpclient is not built with the `webview-auth` feature"
+60
View File
@@ -0,0 +1,60 @@
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION=3.23
ARG RUST_VERSION=1.89
FROM rust:${RUST_VERSION}-alpine AS builder
WORKDIR /src
RUN apk add --no-cache \
autoconf \
automake \
build-base \
file \
gettext-dev \
gmp-dev \
gnutls-dev \
libtool \
libxml2-dev \
linux-headers \
lz4-dev \
make \
nettle-dev \
openssl-dev \
p11-kit-dev \
patch \
pkgconf \
zlib-dev
COPY . .
RUN make build \
BUILD_GUI_HELPER=0 \
INCLUDE_GUI=0 \
LIBXML2_STATIC=1
RUN install -Dm755 target/release/gpclient /out/usr/bin/gpclient \
&& install -Dm755 packaging/files/usr/libexec/gpclient/vpnc-script /out/usr/libexec/gpclient/vpnc-script \
&& install -Dm755 packaging/files/usr/libexec/gpclient/hipreport.sh /out/usr/libexec/gpclient/hipreport.sh
FROM alpine:${ALPINE_VERSION}
RUN apk add --no-cache \
ca-certificates \
gmp \
gnutls \
iproute2 \
iputils \
libxml2 \
lz4 \
nettle \
openssl \
p11-kit \
zlib \
&& update-ca-certificates
COPY --from=builder /out/ /
ENTRYPOINT ["gpclient"]
CMD ["--help"]