-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add casdoor * update docker-compose
- Loading branch information
Showing
7 changed files
with
156 additions
and
10 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
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 @@ | ||
# Distributed under the terms of the Modified BSD License. | ||
|
||
ARG BASE_NAMESPACE | ||
ARG BASE_IMG_BUILD="go-stack" | ||
ARG BASE_IMG="node" | ||
|
||
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG_BUILD} as builder | ||
COPY work /opt/utils/ | ||
RUN source /opt/utils/script-setup-casdoor.sh \ | ||
&& setup_casdoor | ||
|
||
|
||
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} | ||
COPY --from=builder /opt/casdoor /opt/casdoor | ||
COPY work/app.conf /opt/casdoor/conf/app.conf | ||
RUN mkdir -pv /root/web && ln -sf /opt/casdoor/web/build /root/web/ | ||
|
||
LABEL maintainer="haobibo@gmail.com" | ||
ENV RUNNING_IN_DOCKER true | ||
WORKDIR /opt/casdoor | ||
EXPOSE 8000 |
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,15 @@ | ||
# Casdoor | ||
|
||
## debug | ||
|
||
```shell | ||
docker build -t qpod0dev/casdoor \ | ||
-f docker_casdoor/Dockerfile \ | ||
--build-arg="BASE_NAMESPACE=qpod0dev" \ | ||
docker_casdoor | ||
|
||
docker run -it \ | ||
-p 8000:8000 \ | ||
qpod0dev/casdoor \ | ||
bash | ||
``` |
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,41 @@ | ||
version: '3.7' | ||
|
||
services: | ||
db-postgres: | ||
# su postgres && psql -d casdoor -U pg-casdoor-username | ||
image: postgres:15 | ||
container_name: db-postgres | ||
environment: | ||
POSTGRES_DB: casdoor | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
|
||
svc-casdoor: | ||
image: qpod/casdoor | ||
# build: | ||
# context: ../ | ||
# dockerfile: Dockerfile | ||
# args: | ||
# BASE_NAMESPACE: qpod0dev | ||
container_name: svc-casdoor | ||
# command: ["/bin/bash", "--login", "/opt/casdoor/server", "--createDatabase=true"] | ||
command: | | ||
/bin/bash -l -c ' | ||
ls -alh /opt/casdoor | ||
echo "driverName = postgres" >> /opt/casdoor/conf/app.conf | ||
echo "dataSourceName = \"user=postgres password=postgres host=db-postgres port=5432 sslmode=disable dbname=casdoor\"" >> /opt/casdoor/conf/app.conf | ||
sleep 8s | ||
cat /opt/casdoor/conf/app.conf | ||
/opt/casdoor/server -createDatabase=true' | ||
environment: | ||
RUNNING_IN_DOCKER: "true" | ||
ports: | ||
- 8000:8000 | ||
depends_on: | ||
- db-postgres | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl", "--head", "-fsSk", "https://localhost:8000/health/ready" ] | ||
interval: 30s | ||
timeout: 30s | ||
start_period: 5s | ||
retries: 3 |
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,31 @@ | ||
appname = casdoor | ||
authState = "casdoor" | ||
batchSize = 100 | ||
copyrequestbody = true | ||
dbName = casdoor | ||
defaultStorageProvider = | ||
enableGzip = true | ||
frontendBaseDir = "../casdoor" | ||
httpport = 8000 | ||
initDataFile = "./init_data.json" | ||
initScore = 0 | ||
isCloudIntranet = false | ||
isDemoMode = false | ||
isUsernameLowered = false | ||
ldapServerPort = 389 | ||
logConfig = {"filename": "logs/casdoor.log", "maxdays":99999, "perm":"0770"} | ||
logPostOnly = true | ||
origin = | ||
originFrontend = | ||
quota = {"organization": -1, "user": -1, "application": -1, "provider": -1} | ||
radiusSecret = "secret" | ||
radiusServerPort = 1812 | ||
redisEndpoint = | ||
runmode = dev | ||
showSql = false | ||
socks5Proxy = "127.0.0.1:10808" | ||
staticBaseUrl = "https://cdn.casbin.org" | ||
tableNamePrefix = | ||
verificationCodeTimeout = 10 | ||
# driverName = postgres | ||
# dataSourceName = "user=postgres password=postgres host=localhost port=5432 sslmode=disable dbname=casdoor" |
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,29 @@ | ||
source /opt/utils/script-utils.sh | ||
|
||
setup_casdoor() { | ||
# ref: https://github.com/casdoor/casdoor/blob/master/Dockerfile | ||
# Install the latest release of casdoor | ||
VER_CASDOOR=$(curl -sL https://github.com/casdoor/casdoor/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+' ) \ | ||
&& URL_CASDOOR="https://github.com/casdoor/casdoor/archive/refs/tags/v${VER_CASDOOR}.tar.gz" \ | ||
&& echo "Downloading casdoor version ${VER_CASDOOR} from: ${URL_CASDOOR}" \ | ||
&& install_tar_gz $URL_CASDOOR \ | ||
&& mv /opt/casdoor-* /tmp/casdoor && mkdir -pv /opt/casdoor/web /opt/casdoor/conf | ||
|
||
echo "--> Building Backend..." \ | ||
&& cd /tmp/casdoor && ./build.sh \ | ||
&& echo "${VER_CASDOOR}" > version_info.txt \ | ||
&& mv ./server ./swagger ./version_info.txt /opt/casdoor/ \ | ||
&& cat ./conf/app.conf | sort > /opt/casdoor/conf/app.conf | ||
# && go test -v -run TestGetVersionInfo ./util/system_test.go ./util/system.go > version_info.txt \ | ||
|
||
echo "--> Building Frontend..." \ | ||
&& cd /tmp && corepack enable && yarn -v \ | ||
&& cd /tmp/casdoor/web \ | ||
&& yarn set version berry && yarn install && yarn run build \ | ||
&& mv ./build /opt/casdoor/web/ | ||
# && yarn install --frozen-lockfile && yarn run build \ | ||
|
||
echo "--> Finished building casdoor to /opt/casdoor!" \ | ||
&& rm -rf /tmp/casdoor \ | ||
&& echo "@ Version of Casdoor $(cat /opt/casdoor/version_info.txt)" | ||
} |
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