Skip to content

Commit

Permalink
Improve the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MetaZla committed Jul 27, 2024
1 parent edab4a2 commit 810a66e
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CasaOS-AppManagement
69 changes: 65 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,70 @@

Welcome to the CasaIMG project! This project aims to deliver CasaOS (https://github.com/IceWhaleTech/CasaOS) as a docker container.

# Build and Run
To build the container, run the following command:
## Prerequisites
- Docker must be installed on the host (works on Windows and Linux host).
- at least 150MB of RAM

## Getting Started

The image is not yet published on DockerHub, so you have to build it yourself on your machine.

### Step 1: Clone the Repository and Build the Image
```bash
run.ps1
git clone --recurse-submodules https://github.com/Metazla/casa-img
cd casa-img
docker build -t casaimg .
```
Open http://localhost:8080 in your browser to access the web interface.

### Step 2: Run the Container from the Image (See Below)

### Step 3: Access the Web Interface
Open [http://localhost:8080](http://localhost:8080) in your browser to access the web interface.


## Running the Container

### Example: Running from Docker Command Line

The image is not yet published on DockerHub, so you have to build it yourself on your machine:


To run the container, use the following command:

```bash
docker run -d \
-p 8080:8080 \
-e REF_NET=meta \ # optional, the network to attach the container created by CasaIMG
-e REF_PORT=80 \ # optional, the published port for the WEB-UI of a new container installation
-e REF_DOMAIN=nas.localhost \ # optional, the published hostname for the WEB-UI of a new container installation
-e DATA_ROOT=/c/DATA \ # mandatory, path where the data are located (Windows /c/path/DATA or Linux /path/DATA)
-v C:\DATA:/DATA \ # mandatory, where persistent data and app volume will be stored
-v /var/run/docker.sock:/var/run/docker.sock \ # mandatory, allows CasaIMG to control the docker host
--name casaimg casaimg
```

### Example: Docker Compose

Create a `docker-compose.yml` file with the following content:

```yaml
services:
casaimg:
image: casaimg:latest
ports:
- "8080:8080"
environment:
REF_NET: meta # optional
REF_PORT: 80 # optional
REF_DOMAIN: nas.localhost # optional
DATA_ROOT: /c/DATA # mandatory, path where the data are located (Windows /c/DATA or Linux /path/DATA)
volumes:
- C:\DATA:/DATA # mandatory, where persistent data and app volume will be stored
- /var/run/docker.sock:/var/run/docker.sock # mandatory, allows CasaIMG to control the docker host
```
To start the service with Docker Compose, run:
```bash
docker-compose up -d
```
2 changes: 1 addition & 1 deletion build-docker-img.ps1 → dev/win/build-docker-img.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Define variables
$imageName = "casa-os"
$dockerfilePath = "."
$dockerfilePath = "../.."
$originalPath = Get-Location

# Change to the Dockerfile directory
Expand Down
57 changes: 57 additions & 0 deletions dev/win/run-simple.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Define variables
$imageName = "casa-os"
$containerName = "casa-os-dev"
$dockerfilePath = "../.."
$originalPath = Get-Location

# Change to the Dockerfile directory
Push-Location $dockerfilePath

try {
# Build the Docker image
Write-Host "Building the Docker image..."
docker build -t $imageName .

if ($LASTEXITCODE -ne 0) {
throw "Docker build failed. Exiting."
}

# Check if a container with the same name is already running
Write-Host "Checking for existing container..."
$existingContainer = docker ps -aq --filter "name=$containerName"

if ($existingContainer) {
Write-Host "Stopping and removing existing container..."
docker stop $containerName
docker rm $containerName

if ($LASTEXITCODE -ne 0) {
throw "Failed to stop and remove existing container. Exiting."
}
}

# Run the Docker container
Write-Host "Running the Docker container..."
# DATA_ROOT must be in linux style path so we need to convert C:\DATA to c/DATA
# you need to create a network for it to work docker network create meta
docker run -d `
-p 8080:8080 `
-e DATA_ROOT=/c/DATA `
-v C:\DATA:/DATA `
-v /var/run/docker.sock:/var/run/docker.sock `
--name $containerName $imageName
#C:\Users\<YourUsername>\AppData\Local\Docker\wsl\data
if ($LASTEXITCODE -ne 0) {
throw "Docker run failed. Exiting."
}

Write-Host "Docker container $containerName is up and running."
}
catch {
Write-Host $_
exit $LASTEXITCODE
}
finally {
# Ensure to return to the original path
Pop-Location
}
2 changes: 1 addition & 1 deletion run.ps1 → dev/win/run.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Define variables
$imageName = "casa-os"
$containerName = "casa-os-dev"
$dockerfilePath = "."
$dockerfilePath = "../.."
$originalPath = Get-Location

# Change to the Dockerfile directory
Expand Down

0 comments on commit 810a66e

Please sign in to comment.