From 65398ced12c4b84a1d207f2aebb5b43fd5dafe34 Mon Sep 17 00:00:00 2001 From: pan93412 Date: Thu, 27 Jul 2023 21:27:23 +0800 Subject: [PATCH 1/4] chore: Update test snapshot (#114) --- .../nodejs/__snapshots__/template_test.snap | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/internal/nodejs/__snapshots__/template_test.snap b/internal/nodejs/__snapshots__/template_test.snap index 9cbc17c5..948829bc 100755 --- a/internal/nodejs/__snapshots__/template_test.snap +++ b/internal/nodejs/__snapshots__/template_test.snap @@ -6,12 +6,10 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all -COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +COPY . . RUN yarn install -COPY . . - # Build if we can build it @@ -29,12 +27,10 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all -COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +COPY . . RUN yarn install -COPY . . - # Build if we can build it @@ -46,6 +42,7 @@ RUN echo "\ server { \ listen 8080; \ root /usr/share/nginx/html/static; \ + absolute_redirect off; \ location / { \ try_files \$uri \$uri.html \$uri/index.html /404.html =404; \ } \ @@ -62,12 +59,10 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all -COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +COPY . . RUN yarn install -COPY . . - # Build if we can build it @@ -79,6 +74,7 @@ RUN echo "\ server { \ listen 8080; \ root /usr/share/nginx/html/static; \ + absolute_redirect off; \ location / { \ try_files \$uri /index.html; \ } \ @@ -95,12 +91,10 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all -COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +COPY . . RUN yarn install -COPY . . - # Build if we can build it RUN yarn build @@ -118,12 +112,10 @@ ENV PORT=8080 WORKDIR /src RUN corepack enable && corepack prepare --all -COPY package.json package-lock.json* yarn.lock* pnpm-lock.yaml* .npmrc* ./ +COPY . . RUN yarn install -COPY . . - # Build if we can build it RUN yarn build @@ -135,6 +127,7 @@ RUN echo "\ server { \ listen 8080; \ root /usr/share/nginx/html/static; \ + absolute_redirect off; \ location / { \ try_files \$uri /index.html; \ } \ From 29b845f4762793bf148755322ee8a99fd2ece6f8 Mon Sep 17 00:00:00 2001 From: pan93412 Date: Thu, 27 Jul 2023 21:27:34 +0800 Subject: [PATCH 2/4] fix(lib): nolint:unused for extractStaticOutput (#113) --- pkg/zeaburpack/main.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/zeaburpack/main.go b/pkg/zeaburpack/main.go index 5375834a..72feed25 100644 --- a/pkg/zeaburpack/main.go +++ b/pkg/zeaburpack/main.go @@ -185,6 +185,8 @@ func Build(opt *BuildOptions) error { return nil } +// unused because we are refactoring this part. Ignore this for now. +// nolint:unused func extractStaticOutput(resultImage string, opt *BuildOptions) error { copyFiles := `FROM ` + resultImage + ` CMD ["cp", "-r", "/usr/share/nginx/html/static", "/out/"]` From fa56193c955c949d20e6c6bdbbabe17ad7a0430d Mon Sep 17 00:00:00 2001 From: pan93412 Date: Thu, 27 Jul 2023 21:35:38 +0800 Subject: [PATCH 3/4] feat(planner/python): build-essential for hnswlib (#112) --- internal/python/plan.go | 4 ++++ tests/python-hnswlib/app.py | 3 +++ tests/python-hnswlib/requirements.txt | 1 + 3 files changed, 8 insertions(+) create mode 100644 tests/python-hnswlib/app.py create mode 100644 tests/python-hnswlib/requirements.txt diff --git a/internal/python/plan.go b/internal/python/plan.go index 0167121f..cf8fd9ba 100644 --- a/internal/python/plan.go +++ b/internal/python/plan.go @@ -332,6 +332,10 @@ func determineAptDependencies(ctx *pythonPlanContext) []string { deps = append(deps, "libzbar0") } + if HasDependency(ctx, "hnswlib") { + deps = append(deps, "build-essential") + } + return deps } diff --git a/tests/python-hnswlib/app.py b/tests/python-hnswlib/app.py new file mode 100644 index 00000000..b3504508 --- /dev/null +++ b/tests/python-hnswlib/app.py @@ -0,0 +1,3 @@ +import numpy + +print("Passed!") diff --git a/tests/python-hnswlib/requirements.txt b/tests/python-hnswlib/requirements.txt new file mode 100644 index 00000000..77fec65e --- /dev/null +++ b/tests/python-hnswlib/requirements.txt @@ -0,0 +1 @@ +hnswlib==0.7.0 From 7a312836ab257a2fb5eeff05ba72336e29226cdc Mon Sep 17 00:00:00 2001 From: pan93412 Date: Thu, 27 Jul 2023 21:57:04 +0800 Subject: [PATCH 4/4] fix(planner/python): Always install build-essential (#115) --- internal/python/plan.go | 8 ++------ internal/python/python.go | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/internal/python/plan.go b/internal/python/plan.go index cf8fd9ba..ff64b38e 100644 --- a/internal/python/plan.go +++ b/internal/python/plan.go @@ -318,10 +318,10 @@ func determineInstallCmd(ctx *pythonPlanContext) string { } func determineAptDependencies(ctx *pythonPlanContext) []string { - var deps []string + deps := []string{"build-essential"} if HasDependency(ctx, "mysqlclient") { - deps = append(deps, "libmariadb-dev", "build-essential") + deps = append(deps, "libmariadb-dev") } if HasDependency(ctx, "psycopg2") { @@ -332,10 +332,6 @@ func determineAptDependencies(ctx *pythonPlanContext) []string { deps = append(deps, "libzbar0") } - if HasDependency(ctx, "hnswlib") { - deps = append(deps, "build-essential") - } - return deps } diff --git a/internal/python/python.go b/internal/python/python.go index 17b1c8c5..2794e953 100644 --- a/internal/python/python.go +++ b/internal/python/python.go @@ -15,7 +15,7 @@ func GenerateDockerfile(meta types.PlanMeta) (string, error) { dockerfile += `WORKDIR /app RUN apt-get update -RUN apt-get install ` + aptDeps + ` gcc -y +RUN apt-get install -y ` + aptDeps + ` RUN rm -rf /var/lib/apt/lists/* COPY . . RUN ` + installCmd + `