Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docker): error around missing requirements/base.txt #27608

Merged
merged 5 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/supersetbot/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supersetbot",
"version": "0.4.1",
"version": "0.4.2",
"description": "A bot for the Superset GitHub repo",
"type": "module",
"main": "src/index.js",
Expand Down
8 changes: 4 additions & 4 deletions .github/supersetbot/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ export default function getCLI(context) {

program.command('docker')
.description('Generates/run docker build commands use in CI')
.option('-t, --preset', 'Build preset', /^(lean|dev|dockerize|websocket|py310|ci)$/i, 'lean')
.option('-t, --preset <preset>', 'Build preset', /^(lean|dev|dockerize|websocket|py310|ci)$/i, 'lean')
.option('-c, --context <context>', 'Build context', /^(push|pull_request|release)$/i, 'local')
.option('-r, --context-ref <ref>', 'Reference to the PR, release, or branch')
.option('-p, --platform <platform...>', 'Platforms (multiple values allowed)')
.option('-f, --force-latest', 'Force the "latest" tag on the release')
.option('-v, --verbose', 'Print more info')
.action(function (preset) {
const opts = context.processOptions(this);
.action(function () {
const opts = context.processOptions(this, ['preset']);
opts.platform = opts.platform || ['linux/arm64'];
const cmd = docker.getDockerCommand({ preset, ...opts });
const cmd = docker.getDockerCommand({ ...opts });
context.log(cmd);
if (!opts.dryRun) {
utils.runShellCommand(cmd, false);
Expand Down
12 changes: 12 additions & 0 deletions .github/supersetbot/src/cli.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { spawnSync } from 'child_process';

describe('CLI Test', () => {
test.each([
['./src/supersetbot', ['docker', '--preset', 'dev', '--dry-run'], '--target dev'],
['./src/supersetbot', ['docker', '--dry-run'], '--target lean'],
])('returns %s for release %s', (command, arg, contains) => {
const result = spawnSync(command, arg);
const output = result.stdout.toString();
expect(result.stdout.toString()).toContain(contains);
});
});
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ENV LANG=C.UTF-8 \
SUPERSET_HOME="/app/superset_home" \
SUPERSET_PORT=8088

RUN mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg-info requirements \
RUN mkdir -p ${PYTHONPATH} superset/static requirements superset-frontend apache_superset.egg-info requirements \
&& useradd --user-group -d ${SUPERSET_HOME} -m --no-log-init --shell /bin/bash superset \
&& apt-get update -qq && apt-get install -yqq --no-install-recommends \
build-essential \
Expand All @@ -79,8 +79,8 @@ RUN mkdir -p ${PYTHONPATH} superset/static superset-frontend apache_superset.egg
COPY --chown=superset:superset setup.py MANIFEST.in README.md ./
# setup.py uses the version information in package.json
COPY --chown=superset:superset superset-frontend/package.json superset-frontend/
RUN --mount=type=bind,target=./requirements/base.txt,src=./requirements/base.txt \
--mount=type=cache,target=/root/.cache/pip \
COPY --chown=superset:superset requirements/base.txt requirements/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade setuptools pip && \
pip install -r requirements/base.txt

Expand Down Expand Up @@ -126,8 +126,9 @@ RUN apt-get update -qq \
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox \
&& apt-get autoremove -yqq --purge wget && rm -rf /var/[log,tmp]/* /tmp/* /var/lib/apt/lists/*
# Cache everything for dev purposes...
RUN --mount=type=bind,target=./requirements/development.txt,src=./requirements/development.txt \
--mount=type=cache,target=/root/.cache/pip \

COPY --chown=superset:superset requirements/development.txt requirements/
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r requirements/development.txt

USER superset
Expand Down
Loading