Skip to content

Commit e84e0fc

Browse files
committed
fix: update Docker workflow to build PAM plugin for linux/amd64 architecture
- Modified the PAM plugin build process to compile specifically for linux/amd64, addressing cross-compilation complexities. - Added separate handling for the PAM plugin in the asset copying step to ensure it is correctly placed in the Docker assets directory. - Removed unnecessary build targets for other architectures, streamlining the workflow.
1 parent b54e4ac commit e84e0fc

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/docker-deploy.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,18 @@ jobs:
130130
fi
131131
132132
# Build PAM plugin (Linux only due to PAM dependency)
133+
# Note: Building PAM plugin locally since it requires system PAM headers
134+
# Only building for linux/amd64 since cross-compilation with CGO and PAM dependencies is complex
133135
if [ -d "pkg/plugins/glauth-pam" ]; then
134136
echo "Building PAM plugin..."
135137
cd pkg/plugins/glauth-pam
136138
go mod download
137139
go mod verify
138140
go mod tidy
139-
xgo -image techknowlogick/xgo:latest -v -ldflags="-s -w" -go $GO_RELEASE_V -out pam -dest ../../../bin \
140-
-buildmode=plugin -targets="linux/amd64,linux/386,linux/arm64,linux/arm-7" \
141-
--bringupcmd 'apt update && apt install -y libpam0g-dev' \
142-
-env="GO111MODULE=on,GOPROXY=https://proxy.golang.org,direct" .
141+
142+
# Build for linux/amd64 architecture (runner is amd64)
143+
GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -trimpath -ldflags="-s -w" -buildmode=plugin -o ../../../bin/pam-linux-amd64.so .
144+
143145
cd ../../..
144146
fi
145147
@@ -239,7 +241,7 @@ jobs:
239241
fi
240242
241243
# Copy plugin .so files
242-
for plugin in sqlite mysql postgres pam; do
244+
for plugin in sqlite mysql postgres; do
243245
if [[ -f "bin/${plugin}-linux-amd64.so" ]]; then
244246
cp "bin/${plugin}-linux-amd64.so" "docker/assets/linux/amd64/${plugin}.so"
245247
fi
@@ -250,6 +252,11 @@ jobs:
250252
cp "bin/${plugin}-linux-arm-7.so" "docker/assets/linux/arm/v7/${plugin}.so"
251253
fi
252254
done
255+
256+
# Handle PAM plugin separately (only built for amd64)
257+
if [[ -f "bin/pam-linux-amd64.so" ]]; then
258+
cp "bin/pam-linux-amd64.so" "docker/assets/linux/amd64/pam.so"
259+
fi
253260
254261
- name: Set up Docker Buildx
255262
uses: docker/setup-buildx-action@v3

0 commit comments

Comments
 (0)