Skip to content

Commit

Permalink
Merge branch 'add-ip-address' of https://github.com/beornf/swarm-laun…
Browse files Browse the repository at this point in the history
…cher into beornf-add-ip-address
  • Loading branch information
tlex committed Feb 6, 2021
2 parents 4db4fb7 + c53241d commit 2aa583f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ The following environment variables are important if you don't supply a `/docker
| `LAUNCH_PORTS` | - | NO | Space separated list of PortOnHost:PortInContainer |
| `LAUNCH_NETWORKS` | - | NO | Space separated list of project networks to create. All networks are created with `attachable: true` |
| `LAUNCH_EXT_NETWORKS` | - | NO | Space separated list of external networks to attach to |
| `LAUNCH_EXT_NETWORKS_IPV4` | - | NO | Space separated list of ExternalNetwork:Ipv4Address |
| `LAUNCH_CAP_ADD` | - | NO | Space separated list of capabilities to add |
| `LAUNCH_CAP_DROP` | - | NO | Space separated list of capabilities to drop |
| `LAUNCH_SECURITY_OPT` | - | NO | Space separated list of security options to add |
Expand Down
13 changes: 11 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ if [ -f ${COMPOSE_FILE} ]; then
'LAUNCH_PORTS'
'LAUNCH_NETWORKS'
'LAUNCH_EXT_NETWORKS'
'LAUNCH_EXT_NETWORKS_IPV4'
'LAUNCH_CAP_ADD'
'LAUNCH_CAP_DROP'
'LAUNCH_SECURITY_OPT'
Expand Down Expand Up @@ -253,10 +254,18 @@ xEOF
if [ -n "${LAUNCH_NETWORKS}" ] || [ -n "${LAUNCH_EXT_NETWORKS}" ]; then
echo " networks:" >> ${COMPOSE_FILE}
for NETWORK in ${LAUNCH_NETWORKS}; do
echo " - ${NETWORK}" >> ${COMPOSE_FILE}
echo " ${NETWORK}:" >> ${COMPOSE_FILE}
done
for NETWORK in ${LAUNCH_EXT_NETWORKS}; do
echo " - ${NETWORK}" >> ${COMPOSE_FILE}
echo " ${NETWORK}:" >> ${COMPOSE_FILE}
if [ -n "${LAUNCH_EXT_NETWORKS_IPV4}" ]; then
for NETWORK_IPV4 in ${LAUNCH_EXT_NETWORKS_IPV4}; do
if [ "${NETWORK_IPV4%%:*}" = "${NETWORK}" ]; then
echo " ipv4_address: ${NETWORK_IPV4##*:}" >> ${COMPOSE_FILE}
break
fi
done
fi
done
echo "networks:" >> ${COMPOSE_FILE}
for NETWORK in ${LAUNCH_NETWORKS}; do
Expand Down

0 comments on commit 2aa583f

Please sign in to comment.