-
Notifications
You must be signed in to change notification settings - Fork 9
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
Showing
5 changed files
with
229 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,15 @@ | ||
FROM golang:1.20 | ||
|
||
WORKDIR /app/Open-OAuth2Playground | ||
|
||
COPY ./go.mod . | ||
COPY ./go.sum . | ||
|
||
ENV GOPROXY=https://goproxy.cn,direct | ||
RUN go mod download | ||
COPY . . | ||
RUN go build -o OAuth2Playground . | ||
|
||
EXPOSE 80 | ||
|
||
CMD ["./OAuth2Playground"] |
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
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,35 @@ | ||
#!/bin/bash | ||
# cas_init_script.sh | ||
|
||
mkdir -p /export/data/ | ||
chmod 777 /export/data/ | ||
sqlite3 /export/data/cas.db <<EOF | ||
CREATE TABLE IF NOT EXISTS user (username TEXT, password TEXT, name TEXT); | ||
DELETE FROM user; | ||
INSERT INTO user (username, password, name) VALUES ('cas', '123456', '测试用户'); | ||
EOF | ||
|
||
echo "cas.db created successfully!" | ||
|
||
# 读取环境变量,如果未设置,则使用默认值 | ||
CAS_SERVER_NAME=${CAS_SERVER_NAME:-"http://localhost:8444"} | ||
SERVER_PORT=${SERVER_PORT:-"8444"} | ||
|
||
# 配置文件路径 | ||
CAS_PROPERTIES_FILE="/etc/cas/config/cas.properties" | ||
|
||
# 检查并替换或添加 server.port | ||
if grep -q "server.port" "$CAS_PROPERTIES_FILE"; then | ||
sed -i "s#server.port=.*#server.port=${SERVER_PORT}#" "$CAS_PROPERTIES_FILE" | ||
else | ||
echo "server.port=${SERVER_PORT}" >> "$CAS_PROPERTIES_FILE" | ||
fi | ||
|
||
# 检查并替换或添加 cas.server.name | ||
if grep -q "cas.server.name" "$CAS_PROPERTIES_FILE"; then | ||
sed -i "s#cas.server.name=.*#cas.server.name=${CAS_SERVER_NAME}#" "$CAS_PROPERTIES_FILE" | ||
else | ||
echo "cas.server.name=${CAS_SERVER_NAME}" >> "$CAS_PROPERTIES_FILE" | ||
fi | ||
|
||
echo "read configuration successfully!" |
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,24 @@ | ||
version: '3' | ||
services: | ||
open-oauth2playground: | ||
image: lacey620/open-oauth2playground:v1.0 | ||
container_name: open-oauth2playground | ||
restart: always | ||
ports: | ||
- "8080:80" | ||
volumes: | ||
- ./cfg.json:/app/Open-OAuth2Playground/cfg.json | ||
command: ["/app/Open-OAuth2Playground/OAuth2Playground"] | ||
cas-demo: | ||
image: lacey620/cas-demo:v6.5.9 | ||
container_name: cas-demo | ||
restart: always | ||
ports: | ||
- "8444:8444" | ||
environment: | ||
- CAS_SERVER_NAME= | ||
- SERVER_PORT= | ||
volumes: | ||
- ./cas_init_script.sh:/cas-overlay/cas_init_script.sh | ||
entrypoint: ["/bin/bash", "-c"] | ||
command: ["/cas-overlay/cas_init_script.sh && java -server -noverify -Xmx2048M -jar /cas-overlay/cas.war"] |