@opencode-cloud/core 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +1 -1
- package/package.json +1 -1
- package/src/config/mod.rs +6 -1
- package/src/config/schema.rs +0 -1
- package/src/docker/Dockerfile +29 -28
- package/src/docker/README.dockerhub.md +2 -2
- package/src/docker/image.rs +3 -0
package/Cargo.toml
CHANGED
package/package.json
CHANGED
package/src/config/mod.rs
CHANGED
|
@@ -88,10 +88,15 @@ pub fn load_config() -> Result<Config> {
|
|
|
88
88
|
.with_context(|| format!("Failed to read config file: {}", config_path.display()))?;
|
|
89
89
|
|
|
90
90
|
// Parse JSONC (JSON with comments)
|
|
91
|
-
let parsed_value = parse_to_serde_value(&contents, &Default::default())
|
|
91
|
+
let mut parsed_value = parse_to_serde_value(&contents, &Default::default())
|
|
92
92
|
.map_err(|e| anyhow::anyhow!("Invalid JSONC in config file: {e}"))?
|
|
93
93
|
.ok_or_else(|| anyhow::anyhow!("Config file is empty"))?;
|
|
94
94
|
|
|
95
|
+
// Drop deprecated keys that were removed from the schema.
|
|
96
|
+
if let Some(obj) = parsed_value.as_object_mut() {
|
|
97
|
+
obj.remove("opencode_commit");
|
|
98
|
+
}
|
|
99
|
+
|
|
95
100
|
// Deserialize into Config struct (deny_unknown_fields will reject unknown keys)
|
|
96
101
|
let config: Config = serde_json::from_value(parsed_value).with_context(|| {
|
|
97
102
|
format!(
|
package/src/config/schema.rs
CHANGED
package/src/docker/Dockerfile
CHANGED
|
@@ -34,9 +34,6 @@
|
|
|
34
34
|
# -----------------------------------------------------------------------------
|
|
35
35
|
FROM ubuntu:24.04 AS runtime
|
|
36
36
|
|
|
37
|
-
# Pin opencode fork commit used during build
|
|
38
|
-
ARG OPENCODE_COMMIT=798ccdba1265b7e5499ba49db2f99ca1dd4a15d7
|
|
39
|
-
|
|
40
37
|
# OCI Labels for image metadata
|
|
41
38
|
LABEL org.opencontainers.image.title="opencode-cloud"
|
|
42
39
|
LABEL org.opencontainers.image.description="AI-assisted development environment with opencode"
|
|
@@ -520,7 +517,8 @@ RUN echo 'export PATH="/home/opencode/.local/bin:$PATH"' >> /home/opencode/.zshr
|
|
|
520
517
|
# Clone the fork and build opencode from source (as non-root user)
|
|
521
518
|
# Pin to specific commit for reproducibility
|
|
522
519
|
# Build opencode from source (BuildKit cache mounts disabled for now)
|
|
523
|
-
RUN
|
|
520
|
+
RUN OPENCODE_COMMIT="8694cc2e60422ad82d5ca72b67716423b18dabc2" \
|
|
521
|
+
&& rm -rf /tmp/opencode-repo \
|
|
524
522
|
&& git clone --depth 1 https://github.com/pRizz/opencode.git /tmp/opencode-repo \
|
|
525
523
|
&& cd /tmp/opencode-repo \
|
|
526
524
|
&& git fetch --depth 1 origin "${OPENCODE_COMMIT}" \
|
|
@@ -573,21 +571,31 @@ RUN ls -la /usr/local/bin/opencode-broker \
|
|
|
573
571
|
# -----------------------------------------------------------------------------
|
|
574
572
|
# Nginx Reverse Proxy for UI + API
|
|
575
573
|
# -----------------------------------------------------------------------------
|
|
576
|
-
# Serve the built UI from /var/www/opencode and proxy
|
|
577
|
-
# TODO: Explore a sustainable routing strategy (e.g., backend-driven base URL or
|
|
578
|
-
# TODO: content-type aware proxying without hardcoded path lists).
|
|
574
|
+
# Serve the built UI from /var/www/opencode and proxy all 3000 traffic to backend.
|
|
579
575
|
RUN rm -f /etc/nginx/sites-enabled/default /etc/nginx/conf.d/default.conf 2>/dev/null || true \
|
|
580
576
|
&& printf '%s\n' \
|
|
581
577
|
'server {' \
|
|
582
578
|
' listen 3000;' \
|
|
583
579
|
' server_name _;' \
|
|
584
580
|
'' \
|
|
585
|
-
'
|
|
586
|
-
' index index.html;' \
|
|
587
|
-
'' \
|
|
588
|
-
' location = /health {' \
|
|
581
|
+
' location / {' \
|
|
589
582
|
' proxy_pass http://127.0.0.1:3001;' \
|
|
583
|
+
' proxy_http_version 1.1;' \
|
|
584
|
+
' proxy_set_header Upgrade $http_upgrade;' \
|
|
585
|
+
' proxy_set_header Connection "upgrade";' \
|
|
586
|
+
' proxy_set_header Host $host;' \
|
|
587
|
+
' proxy_set_header X-Real-IP $remote_addr;' \
|
|
588
|
+
' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' \
|
|
589
|
+
' proxy_set_header X-Forwarded-Proto $scheme;' \
|
|
590
590
|
' }' \
|
|
591
|
+
'}' \
|
|
592
|
+
'' \
|
|
593
|
+
'server {' \
|
|
594
|
+
' listen 3002;' \
|
|
595
|
+
' server_name _;' \
|
|
596
|
+
'' \
|
|
597
|
+
' root /var/www/opencode;' \
|
|
598
|
+
' index index.html;' \
|
|
591
599
|
'' \
|
|
592
600
|
' location /assets/ {' \
|
|
593
601
|
' try_files $uri =404;' \
|
|
@@ -597,17 +605,6 @@ RUN rm -f /etc/nginx/sites-enabled/default /etc/nginx/conf.d/default.conf 2>/dev
|
|
|
597
605
|
' try_files $uri =404;' \
|
|
598
606
|
' }' \
|
|
599
607
|
'' \
|
|
600
|
-
' location ~ ^/(agent|auth|command|config|event|events|global|lsp|mcp|path|permission|project|provider|pty|question|rpc|session|sessions|status|v1|vcs|ws|api) {' \
|
|
601
|
-
' proxy_pass http://127.0.0.1:3001;' \
|
|
602
|
-
' proxy_http_version 1.1;' \
|
|
603
|
-
' proxy_set_header Upgrade $http_upgrade;' \
|
|
604
|
-
' proxy_set_header Connection "upgrade";' \
|
|
605
|
-
' proxy_set_header Host $host;' \
|
|
606
|
-
' proxy_set_header X-Real-IP $remote_addr;' \
|
|
607
|
-
' proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;' \
|
|
608
|
-
' proxy_set_header X-Forwarded-Proto $scheme;' \
|
|
609
|
-
' }' \
|
|
610
|
-
'' \
|
|
611
608
|
' location / {' \
|
|
612
609
|
' try_files $uri $uri/ /index.html;' \
|
|
613
610
|
' }' \
|
|
@@ -746,20 +743,24 @@ RUN rm -f /etc/systemd/system/multi-user.target.wants/nginx.service \
|
|
|
746
743
|
# -----------------------------------------------------------------------------
|
|
747
744
|
# opencode Configuration
|
|
748
745
|
# -----------------------------------------------------------------------------
|
|
749
|
-
# Create opencode.
|
|
746
|
+
# Create opencode.jsonc config file with PAM authentication enabled and UI URL
|
|
750
747
|
RUN mkdir -p /home/opencode/.config/opencode \
|
|
751
748
|
&& printf '%s\n' \
|
|
752
749
|
'{' \
|
|
750
|
+
' // Container UI served via nginx on 3002' \
|
|
753
751
|
' "auth": {' \
|
|
754
752
|
' "enabled": true' \
|
|
753
|
+
' },' \
|
|
754
|
+
' "server": {' \
|
|
755
|
+
' "uiUrl": "http://localhost:3002"' \
|
|
755
756
|
' }' \
|
|
756
757
|
'}' \
|
|
757
|
-
> /home/opencode/.config/opencode/opencode.
|
|
758
|
+
> /home/opencode/.config/opencode/opencode.jsonc \
|
|
758
759
|
&& chown -R opencode:opencode /home/opencode/.config/opencode \
|
|
759
|
-
&& chmod 644 /home/opencode/.config/opencode/opencode.
|
|
760
|
+
&& chmod 644 /home/opencode/.config/opencode/opencode.jsonc
|
|
760
761
|
|
|
761
762
|
# Verify config file exists
|
|
762
|
-
RUN ls -la /home/opencode/.config/opencode/opencode.
|
|
763
|
+
RUN ls -la /home/opencode/.config/opencode/opencode.jsonc && cat /home/opencode/.config/opencode/opencode.jsonc
|
|
763
764
|
|
|
764
765
|
USER opencode
|
|
765
766
|
|
|
@@ -811,8 +812,8 @@ RUN echo "${OPENCODE_CLOUD_VERSION}" > /etc/opencode-cloud-version
|
|
|
811
812
|
# -----------------------------------------------------------------------------
|
|
812
813
|
WORKDIR /home/opencode/workspace
|
|
813
814
|
|
|
814
|
-
# Expose opencode
|
|
815
|
-
EXPOSE 3000 9090
|
|
815
|
+
# Expose opencode ports (3000/3001/3002) and Cockpit (9090)
|
|
816
|
+
EXPOSE 3000 3001 3002 9090
|
|
816
817
|
|
|
817
818
|
# Hybrid init: entrypoint script chooses tini or systemd based on USE_SYSTEMD env
|
|
818
819
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
@@ -28,10 +28,10 @@ docker pull ghcr.io/prizz/opencode-cloud-sandbox:latest
|
|
|
28
28
|
Run the container:
|
|
29
29
|
|
|
30
30
|
```
|
|
31
|
-
docker run --rm -it -p 3000:3000 -p 9090:9090 ghcr.io/prizz/opencode-cloud-sandbox:latest
|
|
31
|
+
docker run --rm -it -p 3000:3000 -p 3001:3001 -p 3002:3002 -p 9090:9090 ghcr.io/prizz/opencode-cloud-sandbox:latest
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
The opencode web UI is available at `http://localhost:3000`. Cockpit runs on `http://localhost:9090`.
|
|
34
|
+
The opencode web UI is available at `http://localhost:3000`. The backend is reachable at `http://localhost:3001`, and the static UI is served at `http://localhost:3002`. Cockpit runs on `http://localhost:9090`.
|
|
35
35
|
|
|
36
36
|
## Source
|
|
37
37
|
|
package/src/docker/image.rs
CHANGED
|
@@ -81,6 +81,7 @@ pub async fn build_image(
|
|
|
81
81
|
tag: Option<&str>,
|
|
82
82
|
progress: &mut ProgressReporter,
|
|
83
83
|
no_cache: bool,
|
|
84
|
+
build_args: Option<HashMap<String, String>>,
|
|
84
85
|
) -> Result<String, DockerError> {
|
|
85
86
|
let tag = tag.unwrap_or(IMAGE_TAG_DEFAULT);
|
|
86
87
|
let full_name = format!("{IMAGE_NAME_GHCR}:{tag}");
|
|
@@ -100,6 +101,7 @@ pub async fn build_image(
|
|
|
100
101
|
.unwrap_or_default()
|
|
101
102
|
.as_nanos()
|
|
102
103
|
);
|
|
104
|
+
let build_args = build_args.unwrap_or_default();
|
|
103
105
|
let options = BuildImageOptions {
|
|
104
106
|
t: full_name.clone(),
|
|
105
107
|
dockerfile: "Dockerfile".to_string(),
|
|
@@ -107,6 +109,7 @@ pub async fn build_image(
|
|
|
107
109
|
session: Some(session_id),
|
|
108
110
|
rm: true,
|
|
109
111
|
nocache: no_cache,
|
|
112
|
+
buildargs: build_args,
|
|
110
113
|
..Default::default()
|
|
111
114
|
};
|
|
112
115
|
|