Skip to content

Commit 7da8767

Browse files
kwonah0claude
andcommitted
fix: resolve container build issues
- Add missing build:electron script to package.json - Switch from Alpine to Debian Bullseye for better compatibility - Simplify Dockerfile and Singularity definition - Fix GitHub Actions workflow for proper Docker/Singularity builds - Remove multi-platform builds to avoid complexity - Use xvfb-run directly in CMD for headless mode 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2113b5b commit 7da8767

29 files changed

+882
-151
lines changed

.github/workflows/build-and-release.yml

Lines changed: 27 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ on:
55
tags:
66
- 'v*'
77
workflow_dispatch:
8-
inputs:
9-
version:
10-
description: 'Version to build'
11-
required: true
12-
default: 'latest'
138

149
env:
1510
REGISTRY: ghcr.io
@@ -39,14 +34,8 @@ jobs:
3934
with:
4035
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4136
tags: |
42-
type=ref,event=branch
43-
type=ref,event=pr
44-
type=semver,pattern={{version}}
45-
type=semver,pattern={{major}}.{{minor}}
46-
type=raw,value=latest,enable={{is_default_branch}}
47-
48-
- name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v3
37+
type=ref,event=tag
38+
type=raw,value=latest
5039
5140
- name: Build and push Docker image
5241
uses: docker/build-push-action@v5
@@ -55,13 +44,11 @@ jobs:
5544
push: true
5645
tags: ${{ steps.meta.outputs.tags }}
5746
labels: ${{ steps.meta.outputs.labels }}
58-
platforms: linux/amd64,linux/arm64
59-
cache-from: type=gha
60-
cache-to: type=gha,mode=max
6147

6248
build-singularity:
6349
runs-on: ubuntu-latest
6450
needs: build-docker
51+
if: startsWith(github.ref, 'refs/tags/')
6552
permissions:
6653
contents: write
6754

@@ -74,84 +61,47 @@ jobs:
7461
with:
7562
singularity-version: 3.8.0
7663

77-
- name: Build Singularity image
64+
- name: Get version
65+
id: get_version
66+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
67+
68+
- name: Build Singularity image from Docker
7869
run: |
79-
# Get the version from tag or input
80-
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
81-
VERSION=${GITHUB_REF#refs/tags/}
82-
else
83-
VERSION="${{ github.event.inputs.version || 'latest' }}"
84-
fi
85-
86-
echo "Building Singularity image for version: $VERSION"
87-
88-
# Build from Docker image
89-
singularity build dtui2-${VERSION}.sif docker://ghcr.io/${{ github.repository }}:${VERSION}
70+
# Build from the Docker image we just pushed
71+
singularity build --force \
72+
dtui2-${{ steps.get_version.outputs.VERSION }}.sif \
73+
docker://${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get_version.outputs.VERSION }}
9074
91-
# Also create a 'latest' version if this is a tagged release
92-
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
93-
cp dtui2-${VERSION}.sif dtui2-latest.sif
94-
fi
75+
# Also create a 'latest' version
76+
cp dtui2-${{ steps.get_version.outputs.VERSION }}.sif dtui2-latest.sif
9577
9678
- name: Create Release
97-
if: startsWith(github.ref, 'refs/tags/')
9879
uses: softprops/action-gh-release@v1
9980
with:
10081
files: |
10182
dtui2-*.sif
10283
scripts/run-singularity.sh
10384
docs/CONTAINER-DEPLOYMENT.md
10485
body: |
105-
## DTUI2 Release ${{ github.ref_name }}
86+
## DTUI2 Release ${{ steps.get_version.outputs.VERSION }}
10687
107-
### 🎯 Singularity 사용법
88+
### 🎯 Quick Start - Singularity (HPC)
10889
```bash
109-
# 이미지 다운로드
110-
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/dtui2-${{ github.ref_name }}.sif
90+
# Download
91+
wget https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/dtui2-${{ steps.get_version.outputs.VERSION }}.sif
11192
112-
# 실행
113-
singularity run dtui2-${{ github.ref_name }}.sif headless
93+
# Run
94+
singularity run dtui2-${{ steps.get_version.outputs.VERSION }}.sif headless
11495
```
11596
116-
### 🐳 Docker 사용법
97+
### 🐳 Quick Start - Docker
11798
```bash
118-
docker pull ghcr.io/${{ github.repository }}:${{ github.ref_name }}
119-
docker run -it ghcr.io/${{ github.repository }}:${{ github.ref_name }}
99+
docker pull ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
100+
docker run -it ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
120101
```
121102
122-
### 📖 자세한 사용법
123-
[Container Deployment Guide](https://github.com/${{ github.repository }}/blob/${{ github.ref_name }}/docs/CONTAINER-DEPLOYMENT.md)
103+
### 📖 Documentation
104+
- [Container Deployment Guide](docs/CONTAINER-DEPLOYMENT.md)
105+
- [Full README](README.md)
124106
env:
125-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126-
127-
update-readme:
128-
runs-on: ubuntu-latest
129-
needs: [build-docker, build-singularity]
130-
if: startsWith(github.ref, 'refs/tags/')
131-
permissions:
132-
contents: write
133-
134-
steps:
135-
- name: Checkout repository
136-
uses: actions/checkout@v4
137-
with:
138-
token: ${{ secrets.GITHUB_TOKEN }}
139-
140-
- name: Update README with latest release info
141-
run: |
142-
VERSION=${GITHUB_REF#refs/tags/}
143-
144-
# Update README with latest version info
145-
sed -i "s/dtui2-v[0-9]\+\.[0-9]\+\.[0-9]\+\.sif/dtui2-${VERSION}.sif/g" README.md || true
146-
sed -i "s/ghcr\.io\/.*:v[0-9]\+\.[0-9]\+\.[0-9]\+/ghcr.io\/${{ github.repository }}:${VERSION}/g" README.md || true
147-
148-
# Commit if there are changes
149-
if git diff --quiet; then
150-
echo "No changes to commit"
151-
else
152-
git config --local user.email "action@github.com"
153-
git config --local user.name "GitHub Action"
154-
git add README.md
155-
git commit -m "chore: update README with release ${VERSION} info"
156-
git push
157-
fi
107+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
# Multi-stage build for DTUI2 React application
2-
FROM node:18-alpine as builder
3-
4-
# Install Python and build tools needed for native modules
5-
RUN apk add --no-cache python3 make g++ linux-headers
1+
# DTUI2 React Docker Image
2+
FROM node:18-bullseye
3+
4+
# Install system dependencies for Electron and node-pty
5+
RUN apt-get update && apt-get install -y \
6+
libgtk-3-0 \
7+
libgbm-dev \
8+
libnotify-dev \
9+
libgconf-2-4 \
10+
libnss3 \
11+
libxss1 \
12+
libasound2 \
13+
libxtst6 \
14+
xauth \
15+
xvfb \
16+
python3 \
17+
make \
18+
g++ \
19+
git \
20+
bash \
21+
curl \
22+
&& rm -rf /var/lib/apt/lists/*
623

724
# Set working directory
825
WORKDIR /app
@@ -11,63 +28,26 @@ WORKDIR /app
1128
COPY package*.json ./
1229

1330
# Install dependencies
14-
RUN npm ci --only=production
31+
RUN npm ci
1532

1633
# Copy source code
1734
COPY . .
1835

1936
# Build the application
20-
RUN npm run build:electron
21-
22-
# Production stage
23-
FROM node:18-alpine
24-
25-
# Install required system dependencies
26-
RUN apk add --no-cache \
27-
bash \
28-
curl \
29-
git \
30-
python3 \
31-
make \
32-
g++ \
33-
linux-headers \
34-
xvfb \
35-
dbus \
36-
gtk+3.0 \
37-
libxss \
38-
gconf \
39-
libnss \
40-
libasound
41-
42-
# Create app user
43-
RUN addgroup -g 1001 -S dtui && \
44-
adduser -S dtui -u 1001 -G dtui
45-
46-
# Set working directory
47-
WORKDIR /app
48-
49-
# Copy built application from builder stage
50-
COPY --from=builder --chown=dtui:dtui /app .
37+
RUN npm run build
5138

5239
# Create necessary directories
53-
RUN mkdir -p /app/data /app/logs && \
54-
chown -R dtui:dtui /app
55-
56-
# Switch to non-root user
57-
USER dtui
40+
RUN mkdir -p /app/data /app/logs
5841

5942
# Set environment variables
6043
ENV NODE_ENV=production
6144
ENV DISPLAY=:99
6245
ENV DTUI_CONFIG_DIR=/app/data
6346
ENV DTUI_LOG_DIR=/app/logs
47+
ENV ELECTRON_DISABLE_SANDBOX=true
6448

6549
# Expose port (if needed for web interface)
6650
EXPOSE 3000
6751

68-
# Health check
69-
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
70-
CMD node -e "console.log('DTUI2 container is healthy')" || exit 1
71-
72-
# Default command - run in headless mode
73-
CMD ["npm", "run", "electron:headless"]
52+
# Default command - run in headless mode with xvfb
53+
CMD ["xvfb-run", "-a", "npm", "run", "electron"]

dtui.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"timeout": 5000,
99
"streaming": false,
1010
"outputFormat": {
11-
"useCodeBlock": true,
11+
"useCodeBlock": false,
1212
"codeBlockSyntax": "shell"
1313
}
1414
}

dtui2.def

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,71 @@
11
Bootstrap: docker
2-
From: node:18-alpine
2+
From: node:18-bullseye
33

44
%files
55
. /app
66

77
%post
88
# Install system dependencies
9-
apk update
10-
apk add --no-cache \
11-
bash \
12-
curl \
13-
git \
9+
apt-get update
10+
apt-get install -y \
11+
libgtk-3-0 \
12+
libgbm-dev \
13+
libnotify-dev \
14+
libgconf-2-4 \
15+
libnss3 \
16+
libxss1 \
17+
libasound2 \
18+
libxtst6 \
19+
xauth \
20+
xvfb \
1421
python3 \
1522
make \
1623
g++ \
17-
linux-headers \
18-
xvfb \
19-
dbus \
20-
gtk+3.0 \
21-
libxss \
22-
gconf \
23-
libnss \
24-
libasound \
24+
git \
25+
bash \
26+
curl \
2527
ca-certificates
28+
29+
rm -rf /var/lib/apt/lists/*
2630

2731
# Set working directory
2832
cd /app
2933

3034
# Install Node.js dependencies
31-
npm ci --only=production
35+
npm ci
3236

3337
# Build the application
34-
npm run build:electron
38+
npm run build
3539

3640
# Create necessary directories
3741
mkdir -p /app/data /app/logs /app/config
3842

3943
# Set proper permissions
4044
chmod -R 755 /app
41-
chmod +x /app/node_modules/.bin/*
4245

4346
%environment
4447
export NODE_ENV=production
4548
export DTUI_CONFIG_DIR=/app/data
4649
export DTUI_LOG_DIR=/app/logs
4750
export PATH=/app/node_modules/.bin:$PATH
4851
export ELECTRON_DISABLE_SANDBOX=true
52+
export DISPLAY=:99
4953

5054
%runscript
5155
cd /app
5256
if [ "$1" = "headless" ]; then
53-
exec npm run electron:headless
57+
exec xvfb-run -a npm run electron
5458
elif [ "$1" = "gui" ]; then
5559
exec npm run electron
5660
elif [ "$1" = "shell" ]; then
5761
exec /bin/bash
5862
else
59-
exec npm run electron:headless
63+
exec xvfb-run -a npm run electron
6064
fi
6165

6266
%startscript
6367
cd /app
64-
npm run electron:headless &
68+
xvfb-run -a npm run electron &
6569

6670
%test
6771
cd /app
@@ -74,7 +78,6 @@ From: node:18-alpine
7478

7579
Usage:
7680
singularity run dtui2.sif [headless|gui|shell]
77-
singularity exec dtui2.sif npm run electron:headless
7881

7982
Options:
8083
headless Run in headless mode (default)
@@ -97,5 +100,5 @@ From: node:18-alpine
97100

98101
%labels
99102
Author kwonah0
100-
Version v1.2.1
103+
Version v1.3.0
101104
Description DTUI2 - Claude Code Style AI Terminal for HPC environments

manual-test-basic-ls.png

95.3 KB
Loading

manual-test-colored-ls.png

112 KB
Loading

manual-test-echo.png

102 KB
Loading

manual-test-final-result.png

59.5 KB
Loading

manual-test-long-ls.png

128 KB
Loading

manual-test-no-input.png

55.6 KB
Loading

0 commit comments

Comments
 (0)