Skip to content

Commit 8e55698

Browse files
authored
Update the README.md to describe building with devcontainers (#521)
1 parent 47338b2 commit 8e55698

File tree

1 file changed

+68
-4
lines changed

1 file changed

+68
-4
lines changed

README.md

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,59 @@ sudo emerge -av net-vpn/GlobalProtect-openconnect
153153

154154
## Build from source
155155

156-
You can also build the client from source, steps are as follows:
156+
You can build the client from source using either a devcontainer (recommended) or a local setup.
157157

158-
### Prerequisites
158+
### Option 1: Using DevContainer (Recommended)
159+
160+
This project includes a devcontainer configuration that provides a consistent build environment with all dependencies pre-installed.
161+
162+
#### Prerequisites
163+
164+
- [Docker](https://docs.docker.com/get-docker/)
165+
- [VS Code](https://code.visualstudio.com/) with [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) (optional, for IDE support)
166+
167+
#### Build Steps
168+
169+
1. Clone the repository:
170+
```bash
171+
git clone https://github.com/yuezk/GlobalProtect-openconnect.git
172+
cd GlobalProtect-openconnect
173+
```
174+
175+
2. Build the devcontainer image:
176+
```bash
177+
docker build -t gpoc-devcontainer .devcontainer/
178+
```
179+
180+
3. Install `jq` in the container and build the project:
181+
```bash
182+
docker run --privileged --cap-add=NET_ADMIN --device=/dev/net/tun \
183+
-v "$(pwd)":/workspace -w /workspace --user root gpoc-devcontainer \
184+
bash -c "apt-get update && apt-get install -y jq"
185+
186+
docker run --privileged --cap-add=NET_ADMIN --device=/dev/net/tun \
187+
-v "$(pwd)":/workspace -w /workspace gpoc-devcontainer \
188+
bash -c "export PATH=/usr/local/cargo/bin:\$PATH && make build"
189+
```
190+
191+
4. The built binaries will be available in `target/release/`:
192+
- `gpclient` - CLI client
193+
- `gpservice` - Background service
194+
- `gpauth` - Authentication helper
195+
- `gpgui-helper` - GUI helper
196+
197+
#### Alternative: VS Code DevContainer
198+
199+
1. Open the project in VS Code
200+
2. When prompted, click "Reopen in Container" or run the command "Dev Containers: Reopen in Container"
201+
3. Once the container is built and running, open a terminal in VS Code and run:
202+
```bash
203+
make build
204+
```
205+
206+
### Option 2: Local Build
207+
208+
#### Prerequisites
159209

160210
- [Install Rust 1.82 or later](https://www.rust-lang.org/tools/install)
161211
- Install Tauri dependencies: https://tauri.app/start/prerequisites/
@@ -164,12 +214,26 @@ You can also build the client from source, steps are as follows:
164214
- Install `pkexec`, `gnome-keyring` (or `pam_kwallet` on KDE)
165215
- Install `nodejs` and `pnpm` (optional only if you downloaded the source tarball from the release page and run with the `BUILD_FE=0` flag, see below)
166216

167-
### Build
217+
#### Build Steps
168218

169219
1. Download the source code tarball from [releases](https://github.com/yuezk/GlobalProtect-openconnect/releases) page. Choose `globalprotect-openconnect-${version}.tar.gz`.
170220
2. Extract the tarball with `tar -xzf globalprotect-openconnect-${version}.tar.gz`.
171221
3. Enter the source directory and run `make build BUILD_FE=0` to build the client.
172-
3. Run `sudo make install` to install the client. (Note, `DESTDIR` is not supported)
222+
4. Run `sudo make install` to install the client. (Note, `DESTDIR` is not supported)
223+
224+
### Testing the Build
225+
226+
After building, you can test the CLI client:
227+
228+
```bash
229+
./target/release/gpclient --help
230+
```
231+
232+
### Build Options
233+
234+
- `BUILD_GUI=0` - Disable GUI components (CLI only)
235+
- `BUILD_FE=0` - Skip frontend build (use pre-built assets)
236+
- `OFFLINE=1` - Build in offline mode using vendored dependencies
173237

174238
## FAQ
175239

0 commit comments

Comments
 (0)