Skip to content

Commit b532ca8

Browse files
Merge pull request #2 from sehan-dissanayake/fix-python-custom
Fix python custom
2 parents ff834fd + 6760484 commit b532ca8

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

gateway/gateway-builder/internal/policyengine/generator.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,16 @@ func copyDir(src, dst string) error {
373373
dstPath := filepath.Join(dst, relPath)
374374

375375
if info.IsDir() {
376+
if info.Name() == ".venv" || info.Name() == "__pycache__" || info.Name() == ".git" {
377+
return filepath.SkipDir
378+
}
376379
return os.MkdirAll(dstPath, info.Mode())
377380
}
378381

382+
if !info.Mode().IsRegular() {
383+
return nil
384+
}
385+
379386
// Copy file
380387
data, err := os.ReadFile(path)
381388
if err != nil {

gateway/gateway-builder/templates/Dockerfile.gateway-runtime.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ RUN chmod +x /app/policy-engine
2828
RUN rm -rf /app/python-executor
2929
COPY python-executor/ /app/python-executor/
3030

31+
# Install python dependencies for custom policies
32+
RUN apt-get update && apt-get install -y --no-install-recommends python3-pip && \
33+
pip3 install --no-cache-dir --upgrade pip setuptools wheel && \
34+
pip3 install --no-cache-dir --target /app/python-libs -r /app/python-executor/requirements.txt && \
35+
apt-get purge -y python3-pip && \
36+
apt-get autoremove -y && \
37+
rm -rf /var/lib/apt/lists/*
3138
USER wso2
3239
3340
# Metadata labels

0 commit comments

Comments
 (0)