Commit 964f72a6 authored by Andres Anaya Amariels's avatar Andres Anaya Amariels 🚀
Browse files

fix: correct COPY command in Dockerfile and enhance script comments in test_sdk.sh

parent 70cee9a2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -3,7 +3,7 @@ FROM labs.etsi.org:5050/ocf/capif/python:3-slim-bullseye
WORKDIR /sdk
WORKDIR /sdk


# Copy project files into the container
# Copy project files into the container
COPY .. .
COPY . .


# Install Python dependencies
# Install Python dependencies
RUN python -m pip install --upgrade pip
RUN python -m pip install --upgrade pip
+25 −1
Original line number Original line Diff line number Diff line
#!/bin/bash
#!/bin/bash


# Name of container image
# ----------------------------
# Configuration
# ----------------------------
CONTAINER_NAME=capif-sdk-runner
CONTAINER_NAME=capif-sdk-runner
IMAGE_NAME=opencapif_sdk
IMAGE_NAME=opencapif_sdk
BRANCH_NAME=${CI_COMMIT_REF_NAME}
BRANCH_NAME=${CI_COMMIT_REF_NAME}
@@ -9,14 +11,36 @@ NETWORK_NAME=capif-network
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"


# ----------------------------
# Create Docker network (if it doesn't exist)
# ----------------------------
echo "🌐 Checking for existing Docker network: $NETWORK_NAME..."

if ! docker network ls --format '{{.Name}}' | grep -q "^${NETWORK_NAME}$"; then
  echo "🔧 Network not found. Creating network: $NETWORK_NAME..."
  docker network create $NETWORK_NAME
else
  echo "✅ Network $NETWORK_NAME already exists."
fi

# ----------------------------
# Build Docker image
# ----------------------------
echo "🛠️ Building image: $IMAGE_NAME from branch: $BRANCH_NAME with no cache..."
echo "🛠️ Building image: $IMAGE_NAME from branch: $BRANCH_NAME with no cache..."
docker build --no-cache "$PROJECT_ROOT" -t $IMAGE_NAME -f "$SCRIPT_DIR/Dockerfile" --build-arg BRANCH=$BRANCH_NAME
docker build --no-cache "$PROJECT_ROOT" -t $IMAGE_NAME -f "$SCRIPT_DIR/Dockerfile" --build-arg BRANCH=$BRANCH_NAME


# ----------------------------
# Run Docker container
# ----------------------------
echo "🚀 Running container: $CONTAINER_NAME in network: $NETWORK_NAME..."
echo "🚀 Running container: $CONTAINER_NAME in network: $NETWORK_NAME..."

docker run \
docker run \
  --rm \
  --rm \
  --name $CONTAINER_NAME \
  --name $CONTAINER_NAME \
  --network $NETWORK_NAME \
  --network $NETWORK_NAME \
  $IMAGE_NAME
  $IMAGE_NAME


# ----------------------------
# Done
# ----------------------------
echo "✅ End of script"
echo "✅ End of script"
 No newline at end of file