mirror of
https://github.com/DomiStyle/docker-idrac6.git
synced 2024-12-22 05:45:22 +01:00
Merge pull request #22 from DomiStyle/docker-secrets
Add support for Docker secrets
This commit is contained in:
commit
9c4bd7a4be
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
idrac_host.txt
|
||||
idrac_password.txt
|
||||
idrac_user.txt
|
||||
idrac_port.txt
|
@ -1,4 +1,4 @@
|
||||
version: '2'
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
idrac1:
|
||||
@ -21,11 +21,18 @@ services:
|
||||
ports:
|
||||
- 5801:5800
|
||||
- 5901:5900
|
||||
environment:
|
||||
- IDRAC_HOST=idrac2.example.org
|
||||
- IDRAC_USER=root
|
||||
- IDRAC_PASSWORD=1234
|
||||
secrets:
|
||||
- idrac_host
|
||||
- idrac_user
|
||||
- idrac_password
|
||||
volumes:
|
||||
- /path/to/app:/app
|
||||
- /path/to/media:/vmedia
|
||||
- /path/to/screenshots:/screenshots
|
||||
secrets:
|
||||
idrac_host:
|
||||
file: ./idrac_host.txt
|
||||
idrac_user:
|
||||
file: ./idrac_user.txt
|
||||
idrac_password:
|
||||
file: ./idrac_password.txt
|
||||
|
20
startapp.sh
20
startapp.sh
@ -6,6 +6,26 @@ NC='\033[0m'
|
||||
|
||||
echo "Starting"
|
||||
|
||||
if [ -f "/run/secrets/idrac_host" ]; then
|
||||
echo "Using Docker secret for IDRAC_HOST"
|
||||
IDRAC_HOST="$(cat /run/secrets/idrac_host)"
|
||||
fi
|
||||
|
||||
if [ -f "/run/secrets/idrac_port" ]; then
|
||||
echo "Using Docker secret for IDRAC_PORT"
|
||||
IDRAC_PORT="$(cat /run/secrets/idrac_port)"
|
||||
fi
|
||||
|
||||
if [ -f "/run/secrets/idrac_user" ]; then
|
||||
echo "Using Docker secret for IDRAC_USER"
|
||||
IDRAC_USER="$(cat /run/secrets/idrac_user)"
|
||||
fi
|
||||
|
||||
if [ -f "/run/secrets/idrac_password" ]; then
|
||||
echo "Using Docker secret for IDRAC_PASSWORD"
|
||||
IDRAC_PASSWORD="$(cat /run/secrets/idrac_password)"
|
||||
fi
|
||||
|
||||
if [ -z "${IDRAC_HOST}" ]; then
|
||||
echo "${RED}Please set a proper idrac host with IDRAC_HOST${NC}"
|
||||
sleep 2
|
||||
|
Loading…
Reference in New Issue
Block a user