@@ -56,17 +56,92 @@ jobs:
5656 - name : Build External Base Image
5757 shell : bash
5858 run : |
59- # Simplify Dockerfile discovery with more robust approach
59+ # Enhanced debugging for Docker files
6060 echo "Looking for Dockerfiles..."
6161 echo "All Dockerfiles in repository:"
6262 find . -name "Dockerfile" -type f | tee all_dockerfiles.txt
6363
64+ # Count Dockerfiles
65+ DOCKERFILE_COUNT=$(wc -l < all_dockerfiles.txt || echo "0")
66+ echo "Found $DOCKERFILE_COUNT Dockerfiles in repository"
67+
68+ if [ "$DOCKERFILE_COUNT" -eq "0" ]; then
69+ echo "No Dockerfiles found in repository, creating minimal ones"
70+
71+ # Create directory for external dependencies Dockerfile
72+ mkdir -p docker/external
73+
74+ # Create a minimal external dependencies Dockerfile
75+ cat > docker/external/Dockerfile << 'EOF'
76+ FROM ubuntu:20.04
77+
78+ # Install basic dependencies
79+ RUN apt-get update && \
80+ apt-get install -y \
81+ build-essential \
82+ cmake \
83+ git \
84+ wget \
85+ libxml2-dev \
86+ libxerces-c-dev \
87+ liblog4cpp5-dev \
88+ libeigen3-dev \
89+ && rm -rf /var/lib/apt/lists/*
90+
91+ # Install CodeSynthesis XSD
92+ RUN wget https://www.codesynthesis.com/download/xsd/4.0/linux-gnu/x86_64/xsd_4.0.0-1_amd64.deb && \
93+ dpkg -i xsd_4.0.0-1_amd64.deb && \
94+ rm xsd_4.0.0-1_amd64.deb
95+
96+ ENV PATH="/usr/local/bin:${PATH}"
97+ WORKDIR /opt/biogears
98+
99+ CMD ["/bin/bash"]
100+ EOF
101+
102+ # Create directory for builder Dockerfile
103+ mkdir -p docker/builder
104+
105+ # Create a minimal builder Dockerfile
106+ cat > docker/builder/Dockerfile << 'EOF'
107+ ARG EXTERNAL_IMAGE=ghcr.io/hari-ara/biogears-hari-external:latest
108+ FROM ${EXTERNAL_IMAGE}
109+
110+ # Copy source code
111+ COPY . /opt/biogears/core
112+
113+ # Build BioGears
114+ WORKDIR /opt/biogears/core
115+ RUN mkdir -p build && \
116+ cd build && \
117+ cmake .. -DCMAKE_BUILD_TYPE=Release && \
118+ cmake --build . --parallel $(nproc) && \
119+ cd ..
120+
121+ # Copy built libraries and binaries to standard locations
122+ RUN mkdir -p /usr/local/lib /usr/local/bin && \
123+ cp -r build/lib/* /usr/local/lib/ && \
124+ cp -r build/bin/* /usr/local/bin/
125+
126+ WORKDIR /opt/biogears
127+ CMD ["/bin/bash"]
128+ EOF
129+
130+ echo "Created Dockerfiles:"
131+ find docker -name "Dockerfile" -type f | tee all_dockerfiles.txt
132+ fi
133+
64134 # Pick the first Dockerfile for external dependencies
65- EXTERNAL_DOCKERFILE=$(head -n 1 all_dockerfiles.txt)
135+ EXTERNAL_DOCKERFILE=$(grep -i "external" all_dockerfiles.txt | head -n 1 )
66136
67137 if [ -z "$EXTERNAL_DOCKERFILE" ]; then
68- echo "ERROR: No Dockerfiles found in repository"
69- exit 1
138+ echo "No external Dockerfile found, using the first one"
139+ EXTERNAL_DOCKERFILE=$(head -n 1 all_dockerfiles.txt)
140+
141+ if [ -z "$EXTERNAL_DOCKERFILE" ]; then
142+ echo "ERROR: No Dockerfiles found in repository"
143+ exit 1
144+ fi
70145 fi
71146
72147 echo "Using Dockerfile at: $EXTERNAL_DOCKERFILE"
@@ -97,12 +172,17 @@ jobs:
97172 . ./image-digests.txt || { echo "Failed to load image-digests.txt"; cat ./image-digests.txt; }
98173
99174 # Simplify builder Dockerfile discovery
100- echo "Looking for second Dockerfile for builder ..."
101- BUILDER_DOCKERFILE=$(grep -v "^$EXTERNAL_DOCKERFILE$ " all_dockerfiles.txt | head -n 1)
175+ echo "Looking for builder Dockerfile..."
176+ BUILDER_DOCKERFILE=$(grep -i "builder\|release " all_dockerfiles.txt | head -n 1)
102177
103178 if [ -z "$BUILDER_DOCKERFILE" ]; then
104- echo "No second Dockerfile found, using the same one as external"
105- BUILDER_DOCKERFILE=$EXTERNAL_DOCKERFILE
179+ echo "No builder Dockerfile found, using a different one from external"
180+ BUILDER_DOCKERFILE=$(grep -v "^$EXTERNAL_DOCKERFILE$" all_dockerfiles.txt | head -n 1)
181+
182+ if [ -z "$BUILDER_DOCKERFILE" ]; then
183+ echo "No other Dockerfile found, using the same one as external"
184+ BUILDER_DOCKERFILE=$EXTERNAL_DOCKERFILE
185+ fi
106186 fi
107187
108188 echo "Using Dockerfile at: $BUILDER_DOCKERFILE"
0 commit comments