Skip to content

Commit

Permalink
fix: 添加 build.sh 并且修改前端
Browse files Browse the repository at this point in the history
  • Loading branch information
qfdk committed Jan 16, 2025
1 parent d5cce85 commit ff93efd
Show file tree
Hide file tree
Showing 9 changed files with 2,105 additions and 1,420 deletions.
41 changes: 32 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,33 @@

FROM node:lts-alpine
COPY . /src
RUN apk update && apk add bash && \
cd /src; yarn install && \
# Time zone option, if you live in China pleace set it to Asia/Shanghai
ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime

EXPOSE 3000
CMD node /src/bin/www

# 设置工作目录
WORKDIR /app

# 设置时区
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone

# 安装基础工具、pnpm 和 docker
RUN apk add --no-cache bash tzdata docker-cli && \
corepack enable && \
corepack prepare pnpm@latest --activate

# 复制 package.json 和 pnpm-lock.yaml (如果存在)
COPY package.json pnpm-lock.yaml* ./

# 设置 pnpm store 目录并安装依赖
RUN pnpm config set store-dir /root/.local/share/pnpm/store && \
pnpm install --frozen-lockfile

# 复制源代码
COPY . .

# 暴露端口
EXPOSE 3000

# 使用 root 用户运行以确保 docker.sock 访问权限
USER root

# 启动应用
CMD ["node", "bin/www"]
116 changes: 76 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,107 @@
# EasyDockerWeb

A simple Web Ui for Docker using `xterm.js`, `Node.js` and `Socket.io`.
A simple Web UI for Docker using `xterm.js`, `Node.js` and `Socket.io`.

With this solution you will be able to create your owner SAS service.
With this solution you will be able to create your own SAS service.

Features:
- Container management (create, delete, start, stop)
- Interactive terminal
- Log viewer
- System status monitoring
- Image search and pull
- Simple authentication

- If you need to use docker cluster, [https://portainer.io/](https://portainer.io/) may be a good choice.
- search image by name
- terminal
- log
## Quick Start

## Quick start
### Method 1: Using build script (Recommended)
```bash
git clone https://github.com/qfdk/EasyDockerWeb.git
cd EasyDockerWeb
chmod +x build.sh
./build.sh
```

Set EDW_USERNAME and EDW_PASSWORD to overwrite the default username and password.
### Method 2: Manual deployment
```bash
# Build the image
docker build -t easy-docker-web .

*PS:* Default username and password are **admin/admin.**
# Run the container
docker run -d \
--name easy-docker-web \
-p 3000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
easy-docker-web
```

Access the web interface at [http://localhost:3000](http://localhost:3000)

Default credentials: **admin/admin**

You can customize the username and password by setting environment variables:
```bash
docker run -it -d -p 3000:3000 -e EDW_USERNAME='admin' -e EDW_PASSWORD='admin' -v /var/run/docker.sock:/var/run/docker.sock qfdk/easydockerweb
docker run -d \
--name easy-docker-web \
-p 3000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
-e EDW_USERNAME='your_username' \
-e EDW_PASSWORD='your_password' \
easy-docker-web
```

[http://localhost:3000](http://localhost:3000) enjoy ;)

## Requirement
## Requirements

- Node.js
- Docker remote api >= v1.24
- macOS or Linux or windows
- Docker Engine with Remote API >= v1.24
- Linux, macOS, or Windows with Docker installed

## Development mode
## Development Mode

```bash
git clone https://github.com/qfdk/EasyDockerWeb.git
cd EasyDockerWeb
yarn
yarn start
pnpm install
pnpm start
```

## Build your owner docker image
## 中文说明

简单的 docker 管理程序,使用了 express socket.io 来实现前后端通讯。

功能特点:
- 容器增删改查
- 容器交互终端
- 日志查看
- 系统状态监控
- 镜像搜索和拉取
- 简单的身份验证

### 快速开始

#### 方式一:使用构建脚本(推荐)
```bash
git clone https://github.com/qfdk/EasyDockerWeb.git
cd EasyDockerWeb
docker build -t easy-docker-web .
docker run -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock easy-docker-web
chmod +x build.sh
./build.sh
```

## 中文
#### 方式二:手动部署
```bash
# 构建镜像
docker build -t easy-docker-web .

简单的 docker 管理程序,使用了express socket.io 来实现前后端通讯.
# 运行容器
docker run -d \
--name easy-docker-web \
-p 3000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
easy-docker-web
```

- 容器增删改查
- 容器交互
- 日志查看
- 系统状态查看
- 镜像获取
- 计划使用react重构 https://github.com/qfdk/EasyDockerWeb/tree/react
- 添加git actions
访问地址:[http://localhost:3000](http://localhost:3000)

默认账号密码:**admin/admin**

## Images
![login](./images/login.png)
Expand All @@ -77,12 +122,3 @@ docker run -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock easy-docker

## Sponsor
<a href="https://www.jetbrains.com/?from=EasyDockerWeb"><img src="images/jetbrains-variant-4.svg" alt="JetBrains" width="200"/></a>

## React.js web ui (removed)

```bash
cd web-ui
yarn
yarn start
```
[http://localhost:4000](http://localhost:4000)
13 changes: 13 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

echo "🔨 Building Docker image..."
docker build -t easy-docker-web .

echo "🚀 Starting container..."
docker run -d \
--name easy-docker-web \
-p 3000:3000 \
-v /var/run/docker.sock:/var/run/docker.sock \
easy-docker-web

echo "✅ Container started! Access the application at http://localhost:3000"
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"start": "nodemon ./bin/www"
},
"dependencies": {
"body-parser": "1.20.1",
"dockerode": "^4.0.2",
"ejs": "3.1.7",
"body-parser": "1.20.3",
"dockerode": "^4.0.3",
"ejs": "3.1.10",
"express": "^4.16.4",
"express-session": "^1.17.1",
"express-status-monitor": "^1.2.8",
Expand Down
Loading

0 comments on commit ff93efd

Please sign in to comment.