Skip to content

refactor: optimize and clean up network configuration code #6

refactor: optimize and clean up network configuration code

refactor: optimize and clean up network configuration code #6

Workflow file for this run

name: Container IP Example
on: [push]
jobs:
testing:
runs-on: ubuntu-latest
container:
image: golang:1.21-alpine
options: --sysctl net.ipv6.conf.all.disable_ipv6=0
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get Container IP from /etc/hosts
run: |
# Extract the container IP from /etc/hosts
CONTAINER_IP=$(grep $(hostname) /etc/hosts | awk '{ print $1 }')
echo "Container IP: $CONTAINER_IP"
# Set the container IP as an environment variable
echo "CONTAINER_IP=$CONTAINER_IP" >> $GITHUB_ENV
- name: Use Container IP
run: echo "The container IP is ${{ env.CONTAINER_IP }}"