forked from worph/casa-img
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
MetaZla
committed
Jul 22, 2024
0 parents
commit 23f1d14
Showing
22 changed files
with
564 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
**/node_modules/** | ||
**/dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# FIX CRLF always when developer has not set | ||
# Linux/Mac: git config --global core.autocrlf input | ||
# Windows: git config --global core.autocrlf true | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
* eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[submodule "CasaOS"] | ||
path = CasaOS | ||
url = https://github.com/IceWhaleTech/CasaOS | ||
branch = main | ||
[submodule "CasaOS-AppManagement"] | ||
path = CasaOS-AppManagement | ||
url = https://github.com/IceWhaleTech/CasaOS-AppManagement.git | ||
branch = main | ||
[submodule "CasaOS-AppStore"] | ||
path = CasaOS-AppStore | ||
url = https://github.com/IceWhaleTech/CasaOS-AppStore | ||
branch = main | ||
[submodule "CasaOS-Gateway"] | ||
path = CasaOS-Gateway | ||
url = https://github.com/IceWhaleTech/CasaOS-Gateway.git | ||
branch = main | ||
[submodule "CasaOS-LocalStorage"] | ||
path = CasaOS-LocalStorage | ||
url = https://github.com/IceWhaleTech/CasaOS-LocalStorage.git | ||
branch = main | ||
[submodule "CasaOS-MessageBus"] | ||
path = CasaOS-MessageBus | ||
url = https://github.com/IceWhaleTech/CasaOS-MessageBus.git | ||
branch = main | ||
[submodule "CasaOS-UI"] | ||
path = CasaOS-UI | ||
url = https://github.com/IceWhaleTech/CasaOS-UI.git | ||
branch = main | ||
[submodule "CasaOS-UserService"] | ||
path = CasaOS-UserService | ||
url = https://github.com/IceWhaleTech/CasaOS-UserService.git | ||
branch = main |
Submodule CasaOS-AppManagement
added at
b0b2c3
Submodule CasaOS-AppStore
added at
a22405
Submodule CasaOS-Gateway
added at
4a2c4c
Submodule CasaOS-LocalStorage
added at
ca6d67
Submodule CasaOS-MessageBus
added at
c2ad9f
Submodule CasaOS-UserService
added at
faeb91
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,303 @@ | ||
############################################################################################################ | ||
# Build the Go binary for the Gateway | ||
############################################################################################################ | ||
FROM golang:1.21-alpine AS builder-casaos-gateway | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS-Gateway/go.mod ./ | ||
COPY ./CasaOS-Gateway/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY ./CasaOS-Gateway/cmd ./cmd | ||
COPY ./CasaOS-Gateway/common ./common | ||
COPY ./CasaOS-Gateway/pkg ./pkg | ||
COPY ./CasaOS-Gateway/route ./route | ||
COPY ./CasaOS-Gateway/service ./service | ||
COPY ./CasaOS-Gateway/build ./build | ||
COPY ./CasaOS-Gateway/main.go ./main.go | ||
|
||
RUN go build -o casaos-gateway . | ||
|
||
# default config | ||
COPY ./CasaOS-Gateway/build/sysroot/etc/casaos/gateway.ini.sample /etc/casaos/gateway.ini | ||
RUN mkdir -p /var/run/casaos/ && echo -n "{}" >> /var/run/casaos/routes.json | ||
|
||
############################################################################################################ | ||
# Build the Go binary for the User Service | ||
############################################################################################################ | ||
FROM golang:1.21-alpine AS builder-casaos-user-service | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS-UserService/go.mod ./ | ||
COPY ./CasaOS-UserService/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY ./CasaOS-UserService/api ./api | ||
|
||
# Generate Go code from OpenAPI specification | ||
RUN mkdir -p codegen/user_service && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,server,spec -package codegen api/user-service/openapi.yaml > codegen/user_service/user_service_api.go | ||
RUN mkdir -p codegen/message_bus && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-package message_bus https://raw.githubusercontent.com/IceWhaleTech/CasaOS-MessageBus/main/api/message_bus/openapi.yaml > codegen/message_bus/api.go | ||
|
||
|
||
COPY ./CasaOS-UserService/build ./build | ||
COPY ./CasaOS-UserService/cmd ./cmd | ||
COPY ./CasaOS-UserService/common ./common | ||
COPY ./CasaOS-UserService/model ./model | ||
COPY ./CasaOS-UserService/pkg ./pkg | ||
COPY ./CasaOS-UserService/route ./route | ||
COPY ./CasaOS-UserService/service ./service | ||
COPY ./CasaOS-UserService/main.go ./main.go | ||
|
||
RUN go build -o casaos-user-service . | ||
|
||
# default config | ||
COPY ./CasaOS-UserService/build/sysroot/etc/casaos/user-service.conf.sample /etc/casaos/user-service.conf | ||
|
||
############################################################################################################ | ||
# Build the Go binary for the MessageBus | ||
############################################################################################################ | ||
FROM golang:1.21-alpine AS builder-casaos-message-bus | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS-MessageBus/go.mod ./ | ||
COPY ./CasaOS-MessageBus/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY ./CasaOS-MessageBus/api ./api | ||
|
||
# Generate Go code from OpenAPI specification | ||
RUN mkdir -p codegen && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,server,spec -package codegen api/message_bus/openapi.yaml > codegen/message_bus_api.go | ||
|
||
COPY ./CasaOS-MessageBus/build ./build | ||
COPY ./CasaOS-MessageBus/cmd ./cmd | ||
COPY ./CasaOS-MessageBus/common ./common | ||
COPY ./CasaOS-MessageBus/config ./config | ||
COPY ./CasaOS-MessageBus/model ./model | ||
COPY ./CasaOS-MessageBus/repository ./repository | ||
COPY ./CasaOS-MessageBus/route ./route | ||
COPY ./CasaOS-MessageBus/service ./service | ||
COPY ./CasaOS-MessageBus/main.go ./main.go | ||
|
||
RUN go build -o casaos-message-bus . | ||
|
||
# default config | ||
COPY ./CasaOS-MessageBus/build/sysroot/etc/casaos/message-bus.conf.sample /etc/casaos/message-bus.conf | ||
|
||
############################################################################################################ | ||
# Build the Go binary for the AppManagement | ||
############################################################################################################ | ||
FROM golang:1.21-alpine AS builder-casaos-app-management | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS-AppManagement/go.mod ./ | ||
COPY ./CasaOS-AppManagement/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY ./CasaOS-AppManagement/api ./api | ||
|
||
# Generate Go code from OpenAPI specification | ||
RUN mkdir -p codegen && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,server,spec -package codegen api/app_management/openapi.yaml > codegen/app_management_api.go | ||
RUN mkdir -p codegen/message_bus && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,client -package message_bus https://raw.githubusercontent.com/IceWhaleTech/CasaOS-MessageBus/main/api/message_bus/openapi.yaml > codegen/message_bus/api.go | ||
|
||
|
||
COPY ./CasaOS-AppManagement/build ./build | ||
COPY ./CasaOS-AppManagement/service ./service | ||
COPY ./CasaOS-AppManagement/route ./route | ||
COPY ./CasaOS-AppManagement/pkg ./pkg | ||
COPY ./CasaOS-AppManagement/model ./model | ||
COPY ./CasaOS-AppManagement/common ./common | ||
COPY ./CasaOS-AppManagement/cmd ./cmd | ||
COPY ./CasaOS-AppManagement/main.go ./main.go | ||
|
||
RUN go build -o casaos-app-management . | ||
|
||
# default config | ||
COPY ./CasaOS-AppManagement/build/sysroot/etc/casaos/app-management.conf.sample /etc/casaos/app-management.conf | ||
COPY ./CasaOS-AppManagement/build/sysroot/etc/casaos/env /etc/casaos/env | ||
|
||
############################################################################################################ | ||
# Build the Go binary for the LocalStorage | ||
############################################################################################################ | ||
FROM golang:1.21-alpine AS builder-casaos-local-storage | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS-LocalStorage/go.mod ./ | ||
COPY ./CasaOS-LocalStorage/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY ./CasaOS-LocalStorage/api ./api | ||
|
||
# Generate Go code from OpenAPI specification | ||
RUN mkdir -p codegen && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,server,spec -package codegen api/local_storage/openapi.yaml > codegen/local_storage_api.go | ||
RUN mkdir -p codegen/message_bus && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,client -package message_bus https://raw.githubusercontent.com/IceWhaleTech/CasaOS-MessageBus/main/api/message_bus/openapi.yaml > codegen/message_bus/api.go | ||
|
||
|
||
COPY ./CasaOS-LocalStorage/build ./build | ||
COPY ./CasaOS-LocalStorage/cmd ./cmd | ||
COPY ./CasaOS-LocalStorage/common ./common | ||
COPY ./CasaOS-LocalStorage/drivers ./drivers | ||
COPY ./CasaOS-LocalStorage/internal ./internal | ||
COPY ./CasaOS-LocalStorage/model ./model | ||
COPY ./CasaOS-LocalStorage/pkg ./pkg | ||
COPY ./CasaOS-LocalStorage/route ./route | ||
COPY ./CasaOS-LocalStorage/service ./service | ||
COPY ./CasaOS-LocalStorage/main.go ./main.go | ||
COPY ./CasaOS-LocalStorage/misc.go ./misc.go | ||
|
||
RUN go build -o casaos-local-storage . | ||
|
||
# default config | ||
COPY ./CasaOS-LocalStorage/build/sysroot/etc/casaos/local-storage.conf.sample /etc/casaos/local-storage.conf | ||
|
||
############################################################################################################ | ||
# Build the Go binary for the UI | ||
############################################################################################################ | ||
FROM node:16 AS builder-casaos-ui | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS-UI/package.json . | ||
COPY ./CasaOS-UI/yarn.lock . | ||
COPY ./CasaOS-UI/.yarnrc.yml . | ||
COPY ./CasaOS-UI/.yarn ./.yarn | ||
COPY ./CasaOS-UI/main/package.json ./main/package.json | ||
|
||
RUN yarn install | ||
|
||
COPY ./CasaOS-UI . | ||
RUN yarn build | ||
|
||
############################################################################################################ | ||
# Build the Go binary for the CasaOS Main | ||
############################################################################################################ | ||
FROM golang:1.21-alpine AS builder-casaos-main | ||
|
||
WORKDIR /app | ||
|
||
COPY ./CasaOS/go.mod ./ | ||
COPY ./CasaOS/go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY ./CasaOS/api ./api | ||
|
||
# Generate Go code from OpenAPI specification | ||
RUN mkdir -p codegen && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,server,spec -package codegen api/casaos/openapi.yaml > codegen/casaos_api.go | ||
RUN mkdir -p codegen/message_bus && \ | ||
go run github.com/deepmap/oapi-codegen/cmd/[email protected] \ | ||
-generate types,client -package message_bus https://raw.githubusercontent.com/IceWhaleTech/CasaOS-MessageBus/main/api/message_bus/openapi.yaml > codegen/message_bus/api.go | ||
|
||
COPY ./CasaOS/build ./build | ||
COPY ./CasaOS/cmd ./cmd | ||
COPY ./CasaOS/common ./common | ||
COPY ./CasaOS/drivers ./drivers | ||
COPY ./CasaOS/interfaces ./interfaces | ||
COPY ./CasaOS/internal ./internal | ||
COPY ./CasaOS/model ./model | ||
COPY ./CasaOS/pkg ./pkg | ||
COPY ./CasaOS/route ./route | ||
COPY ./CasaOS/service ./service | ||
COPY ./CasaOS/types ./types | ||
COPY ./CasaOS/main.go ./main.go | ||
|
||
RUN go build -o casaos-main . | ||
|
||
# default config | ||
COPY ./CasaOS/build/sysroot/etc/casaos/casaos.conf.sample /etc/casaos/casaos.conf | ||
|
||
############################################################################################################ | ||
# Build the final image | ||
############################################################################################################ | ||
FROM ubuntu:latest | ||
|
||
# Install required packages | ||
RUN apt-get update && apt-get install -y wget curl smartmontools parted ntfs-3g net-tools udevil samba cifs-utils mergerfs unzip | ||
|
||
# install docker https://docs.docker.com/engine/install/ubuntu/ | ||
RUN curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh | ||
|
||
|
||
# Set environment variables | ||
ENV GO_ENV=production | ||
|
||
|
||
# Set the Current Working Directory inside the container | ||
WORKDIR /root/ | ||
|
||
# Copy the Pre-built binary file and configuration files from the gateway | ||
COPY --from=builder-casaos-gateway /app/casaos-gateway . | ||
#COPY --from=builder-casaos-gateway /etc/casaos/gateway.ini /etc/casaos/gateway.ini | ||
COPY ./conf/gateway/gateway.ini /etc/casaos/gateway.ini | ||
COPY --from=builder-casaos-gateway /var/run/casaos/routes.json /var/run/casaos/routes.json | ||
|
||
|
||
# Copy the Pre-built binary file and configuration files from the app-management | ||
COPY --from=builder-casaos-app-management /app/casaos-app-management . | ||
#COPY --from=builder-casaos-app-management /etc/casaos/app-management.conf /etc/casaos/app-management.conf | ||
COPY ./conf/app-management/app-management.conf /etc/casaos/app-management.conf | ||
COPY --from=builder-casaos-app-management /etc/casaos/env /etc/casaos/env | ||
|
||
# Copy the Pre-built binary file from the user-service | ||
COPY --from=builder-casaos-user-service /app/casaos-user-service . | ||
#COPY --from=builder-casaos-user-service /etc/casaos/user-service.conf /etc/casaos/user-service.conf | ||
COPY ./conf/user-service/user-service.conf /etc/casaos/user-service.conf | ||
|
||
# Copy the Pre-built binary file and configuration files from the message-bus | ||
COPY --from=builder-casaos-message-bus /app/casaos-message-bus . | ||
#COPY --from=builder-casaos-message-bus /etc/casaos/message-bus.conf /etc/casaos/message-bus.conf | ||
COPY ./conf/message-bus/message-bus.conf /etc/casaos/message-bus.conf | ||
|
||
# Copy the Pre-built binary file and configuration files from the local-storage | ||
COPY --from=builder-casaos-local-storage /app/casaos-local-storage . | ||
#COPY --from=builder-casaos-local-storage /etc/casaos/local-storage.conf /etc/casaos/local-storage.conf | ||
COPY ./conf/local-storage/local-storage.conf /etc/casaos/local-storage.conf | ||
|
||
# Copy CasaOS-AppStore | ||
#COPY ./appstore-data/main/build/sysroot/var/lib/casaos/appstore/default.new /var/lib/casaos/appstore/default | ||
COPY ./CasaOS-AppStore/Apps /var/lib/casaos/appstore/default/Apps | ||
COPY ./CasaOS-AppStore/*.json /var/lib/casaos/appstore/default/ | ||
|
||
# Copy the Pre-built binary file and configuration files from the main | ||
COPY --from=builder-casaos-main /app/casaos-main . | ||
#COPY --from=builder-casaos-main /etc/casaos/casaos.conf /etc/casaos/casaos.conf | ||
COPY ./conf/casaos/casaos.conf /etc/casaos/casaos.conf | ||
|
||
#COPY ui /var/lib/casaos/www | ||
COPY --from=builder-casaos-ui /app/build/sysroot/var/lib/casaos/www/ /var/lib/casaos/www | ||
|
||
COPY ./entrypoint.sh ./entrypoint.sh | ||
RUN chmod +x ./entrypoint.sh | ||
|
||
# Expose port 8080 to the outside world | ||
EXPOSE 8080 | ||
|
||
# Command to run the executable | ||
ENTRYPOINT ["/root/entrypoint.sh"] | ||
|
||
#Note persistent volum to be mounted on /root/DATA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# CasaIMG Project | ||
|
||
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: | ||
```bash | ||
run.ps1 | ||
``` | ||
Open http://localhost:8080 in your browser to access the web interface. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Define variables | ||
$imageName = "casa-os" | ||
$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 . | ||
} | ||
catch { | ||
Write-Host $_ | ||
exit $LASTEXITCODE | ||
} | ||
finally { | ||
# Ensure to return to the original path | ||
Pop-Location | ||
} |
Oops, something went wrong.