2021-09-10 00:03:40 -05:00
|
|
|
name: container-hostname
|
|
|
|
on: push
|
|
|
|
|
2021-11-03 13:47:47 -05:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
|
|
|
|
2021-09-10 00:03:40 -05:00
|
|
|
jobs:
|
|
|
|
with-hostname:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2021-12-22 13:34:18 -06:00
|
|
|
image: node:16-buster-slim
|
2022-10-06 17:09:43 -05:00
|
|
|
options: "--hostname my.host.local --user 100:101"
|
2021-09-10 00:03:40 -05:00
|
|
|
steps:
|
|
|
|
- run: |
|
2022-10-06 17:09:43 -05:00
|
|
|
echo "UID: $(id -u)"
|
|
|
|
echo "GID: $(id -g)"
|
|
|
|
echo "HOST: $(uname -n)"
|
|
|
|
[[ "$(id -u)" == "100" ]] && [[ "$(id -g)" == "101" ]] && [[ "$(uname -n)" == "my.host.local" ]]
|
2021-09-10 00:03:40 -05:00
|
|
|
|
|
|
|
default-hostname:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container:
|
2021-12-22 13:34:18 -06:00
|
|
|
image: node:16-buster-slim
|
2021-09-10 00:03:40 -05:00
|
|
|
steps:
|
|
|
|
- run: |
|
2022-10-06 17:09:43 -05:00
|
|
|
echo "UID: $(id -u)"
|
|
|
|
echo "GID: $(id -g)"
|
|
|
|
echo "HOST: $(uname -n)"
|
|
|
|
[[ "$(id -u)" == "0" ]] && [[ "$(id -g)" == "0" ]] && [[ $(uname -n) ]] && [[ "$(uname -n)" != "my.host.local" ]]
|