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

feat(app): use crc service #1483

Merged
merged 21 commits into from
Jul 5, 2023
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
18 changes: 1 addition & 17 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,15 @@ jobs:
tlsSecret: dummy-tls-secret
serverDefaults:
defaultUrl: /lab
cpu_request: 0.1
mem_request: 0.5G
disk_request: 1G
gpu_request: 0
lfs_auto_fetch: false
serverOptions:
cpu_request:
order: 1
displayName: Number of CPUs
type: enum
default: 0.1
options: [0.1, 1.0]
mem_request:
order: 2
displayName: Amount of Memory
type: enum
default: 0.5G
options: [0.5G, 2G]
tests:
sessionTypes:
- ${{ matrix.session-type }}
enabled: true
oidc_issuer: https://gitlab.dev.renku.ch
gitlab_token: $RENKUBOT_DEV_GITLAB_ACCESS_TOKEN
debug: false
dummyStores: true
EOF
- name: Install poetry
run: |
Expand Down
40 changes: 23 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
FROM python:3.8-alpine as base
RUN apk add --no-cache curl tini && \
adduser -u 1000 -g 1000 -D kyaku
WORKDIR /home/kyaku/renku-notebooks

FROM base as builder
ENV POETRY_HOME=/opt/poetry
FROM python:3.11-bullseye as builder
olevski marked this conversation as resolved.
Show resolved Hide resolved
RUN groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home renku && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
WORKDIR /app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/renku/.local/bin/pipx install poetry && \
olevski marked this conversation as resolved.
Show resolved Hide resolved
python3 -m venv .venv
COPY poetry.lock pyproject.toml ./
RUN apk add --no-cache alpine-sdk libffi-dev && \
mkdir -p /opt/poetry && \
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.3.2 python3 - && \
/opt/poetry/bin/poetry config virtualenvs.in-project true && \
/opt/poetry/bin/poetry config virtualenvs.options.no-setuptools true && \
/opt/poetry/bin/poetry config virtualenvs.options.no-pip true && \
/opt/poetry/bin/poetry install --only main --no-root
RUN /home/renku/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.venv/bin/pip install -r requirements.txt --prefer-binary

FROM base as runtime
LABEL maintainer="info@datascience.ch"
FROM python:3.11-slim-bullseye
RUN apt-get update && apt-get install -y \
tini && \
rm -rf /var/lib/apt/lists/* && \
groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home renku && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
COPY --from=builder /home/kyaku/renku-notebooks/.venv .venv
WORKDIR /app
COPY --from=builder /app/.venv .venv
COPY renku_notebooks renku_notebooks
COPY resource_schema_migrations resource_schema_migrations
ENTRYPOINT ["tini", "-g", "--"]
Expand Down
61 changes: 29 additions & 32 deletions Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
FROM python:3.8-slim

LABEL maintainer="info@datascience.ch"

RUN pip install --no-cache-dir --disable-pip-version-check -U pip poetry && \
apt-get update && \
apt-get install -y git && \
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get install git-lfs && \
git lfs install && \
apt-get clean && \
FROM python:3.11-bullseye as builder
RUN groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home renku && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
WORKDIR /app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/renku/.local/bin/pipx install poetry && \
olevski marked this conversation as resolved.
Show resolved Hide resolved
python3 -m venv .venv
COPY poetry.lock pyproject.toml ./
RUN /home/renku/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.venv/bin/pip install -r requirements.txt --prefer-binary
RUN /home/renku/.local/bin/poetry export --with dev --without-hashes -o requirements_dev.txt && \
.venv/bin/pip install -r requirements_dev.txt --prefer-binary && \
.venv/bin/pip install renku

FROM python:3.11-slim-bullseye
RUN apt-get update && apt-get install -y \
tini git git-lfs && \
rm -rf /var/lib/apt/lists/* && \
groupadd -g 1000 kyaku && \
useradd -u 1000 -g kyaku -m kyaku

groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home renku && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000

# Install renku
ENV PATH=$PATH:/home/kyaku/.renku/bin

RUN mkdir -p /home/kyaku/.renku/bin && \
virtualenv /home/kyaku/.renku/venv && \
. /home/kyaku/.renku/venv/bin/activate && \
pip install --no-cache renku && \
deactivate && \
ln -s /home/kyaku/.renku/venv/bin/renku /home/kyaku/.renku/bin/renku

# Install all packages
COPY pyproject.toml poetry.lock /home/kyaku/renku-notebooks/
WORKDIR /home/kyaku/renku-notebooks/
RUN poetry install

WORKDIR /app
COPY --from=builder /app/.venv .venv
ENV PATH=$PATH:/app/.venv/bin
COPY renku_notebooks renku_notebooks
COPY resource_schema_migrations resource_schema_migrations
COPY tests tests

CMD ["poetry", "run", "pytest", "tests/integration"]
CMD [".venv/bin/pytest", "-v", "tests/integration"]
42 changes: 24 additions & 18 deletions git_services/Dockerfile.init
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
FROM python:3.9-alpine as base
RUN apk add --no-cache git git-lfs curl tini && \
adduser jovyan -u1000 -g100 --disabled-password
WORKDIR /git_services

FROM base as builder
ENV POETRY_HOME=/opt/poetry
COPY pyproject.toml poetry.lock ./
RUN apk add --no-cache alpine-sdk linux-headers && \
mkdir -p /opt/poetry && \
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.3.2 python3 - && \
/opt/poetry/bin/poetry config virtualenvs.in-project true && \
/opt/poetry/bin/poetry config virtualenvs.options.no-setuptools true && \
/opt/poetry/bin/poetry config virtualenvs.options.no-pip true && \
/opt/poetry/bin/poetry install --only main --no-root
FROM python:3.11-bullseye as builder
RUN groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home jovyan && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
WORKDIR /app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/jovyan/.local/bin/pipx install poetry && \
olevski marked this conversation as resolved.
Show resolved Hide resolved
python3 -m venv .venv
COPY poetry.lock pyproject.toml ./
RUN /home/jovyan/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.venv/bin/pip install -r requirements.txt --prefer-binary

FROM base as runtime
LABEL maintainer="Swiss Data Science Center <info@datascience.ch>"
FROM python:3.11-slim-bullseye
RUN apt-get update && apt-get install -y \
tini git git-lfs && \
rm -rf /var/lib/apt/lists/* && \
groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home jovyan && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
COPY --from=builder /git_services ./
WORKDIR /app
COPY --from=builder /app/.venv .venv
ADD git_services ./git_services
ENTRYPOINT ["tini", "-g", "--"]
CMD [".venv/bin/python3", "-m", "git_services.init.clone"]
44 changes: 25 additions & 19 deletions git_services/Dockerfile.sidecar
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
FROM python:3.9-alpine as base
RUN apk add --no-cache git git-lfs curl tini bash && \
adduser jovyan -u1000 -g100 --disabled-password
WORKDIR /git_services

FROM base as builder
ENV POETRY_HOME=/opt/poetry
COPY pyproject.toml poetry.lock ./
RUN apk add --no-cache alpine-sdk linux-headers && \
mkdir -p /opt/poetry && \
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.3.2 python3 - && \
/opt/poetry/bin/poetry config virtualenvs.in-project true && \
/opt/poetry/bin/poetry config virtualenvs.options.no-setuptools true && \
/opt/poetry/bin/poetry config virtualenvs.options.no-pip true && \
/opt/poetry/bin/poetry install --only main --no-root
FROM python:3.11-bullseye as builder
RUN groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home jovyan && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
WORKDIR /app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/jovyan/.local/bin/pipx install poetry && \
olevski marked this conversation as resolved.
Show resolved Hide resolved
python3 -m venv .venv
COPY poetry.lock pyproject.toml ./
RUN /home/jovyan/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.venv/bin/pip install -r requirements.txt --prefer-binary

FROM base as runtime
LABEL maintainer="Swiss Data Science Center <info@datascience.ch>"
FROM python:3.11-slim-bullseye
RUN apt-get update && apt-get install -y \
tini git git-lfs && \
rm -rf /var/lib/apt/lists/* && \
groupadd --gid 1000 renku && \
useradd --gid 1000 --uid 1000 --groups 100 --create-home jovyan && \
mkdir -p /app && \
chown -R 1000:1000 /app
USER 1000:1000
COPY --from=builder /git_services ./
WORKDIR /app
COPY --from=builder /app/.venv .venv
ADD git_services ./git_services
ENV PATH="${PATH}:/git_services/.venv/bin"
ENV PATH="${PATH}:/app/.venv/bin"
ENTRYPOINT ["tini", "-g", "--"]
CMD [".venv/bin/gunicorn", "-c", "git_services/sidecar/gunicorn.conf.py"]
Loading