Skip to content

Commit

Permalink
squashme: fix docker builds
Browse files Browse the repository at this point in the history
  • Loading branch information
olevski committed May 16, 2023
1 parent 2e5418f commit 0560372
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 26 deletions.
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
FROM python:3.11-bullseye as builder
RUN groupadd --gid 1000 renku && \
adduser --gid 1000 --uid 1000 renku
useradd --gid 1000 --uid 1000 --create-home renku
USER 1000:1000
WORKDIR /app
WORKDIR /home/renku/app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/renku/.local/bin/pipx install poetry
RUN /home/renku/.local/bin/poetry config virtualenvs.in-project true && \
/home/renku/.local/bin/poetry config virtualenvs.options.no-setuptools true && \
/home/renku/.local/bin/poetry config virtualenvs.options.no-pip true
/home/renku/.local/bin/pipx install poetry && \
python3 -m venv .env
COPY poetry.lock pyproject.toml ./
RUN /home/renku/.local/bin/poetry install --only main --no-root
RUN /home/renku/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.env/bin/pip install -r requirements.txt --prefer-binary

FROM python:3.11-slim-bullseye
RUN apt-get update && apt-get install -y \
tini curl && \
rm -rf /var/lib/apt/lists/* && \
groupadd --gid 1000 renku && \
adduser --gid 1000 --uid 1000 renku
useradd --gid 1000 --uid 1000 --create-home renku
USER 1000:1000
WORKDIR /app
COPY --from=builder /app/.venv .venv
WORKDIR /home/renku/app
COPY --from=builder /home/renku/app/.env .env
COPY renku_notebooks renku_notebooks
COPY resource_schema_migrations resource_schema_migrations
ENTRYPOINT ["tini", "-g", "--"]
CMD [".venv/bin/gunicorn", "-b 0.0.0.0:8000", "renku_notebooks.wsgi:app", "-k gevent"]
CMD [".env/bin/gunicorn", "-b 0.0.0.0:8000", "renku_notebooks.wsgi:app", "-k gevent"]
13 changes: 6 additions & 7 deletions git_services/Dockerfile.init
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM python:3.10-bullseye as builder
RUN groupadd --gid 1000 renku && \
adduser --gid 100 --gid 1000 --uid 1000 jovyan
useradd --gid 100 --gid 1000 --uid 1000 --create-home jovyan
USER 1000:1000
WORKDIR /app
WORKDIR /home/jovyan/app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/jovyan/.local/bin/pipx install poetry && \
/home/jovyan/.local/bin/pipx install virtualenv && \
/home/jovyan/.local/bin/virtualenv .env
python3 -m venv .env
COPY poetry.lock pyproject.toml ./
RUN /home/jovyan/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.env/bin/pip install -r requirements.txt --prefer-binary
Expand All @@ -17,10 +16,10 @@ RUN apt-get update && apt-get install -y \
tini curl git git-lfs && \
rm -rf /var/lib/apt/lists/* && \
groupadd --gid 1000 renku && \
adduser --gid 100 --gid 1000 --uid 1000 jovyan
useradd --gid 100 --gid 1000 --uid 1000 --create-home jovyan
USER 1000:1000
WORKDIR /app
COPY --from=builder /app/.env .env
WORKDIR /home/jovyan/app
COPY --from=builder /home/jovyan/app/.env .env
ADD git_services ./git_services
ENTRYPOINT ["tini", "-g", "--"]
CMD [".env/bin/python3", "-m", "git_services.init.clone"]
15 changes: 7 additions & 8 deletions git_services/Dockerfile.sidecar
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
FROM python:3.10-bullseye as builder
RUN groupadd --gid 1000 renku && \
adduser --gid 100 --gid 1000 --uid 1000 jovyan
useradd --gid 100 --gid 1000 --uid 1000 --create-home jovyan
USER 1000:1000
WORKDIR /app
WORKDIR /home/jovyan/app
RUN python3 -m pip install --user pipx && \
python3 -m pipx ensurepath && \
/home/jovyan/.local/bin/pipx install poetry && \
/home/jovyan/.local/bin/pipx install virtualenv && \
/home/jovyan/.local/bin/virtualenv .env
python3 -m venv .env
COPY poetry.lock pyproject.toml ./
RUN /home/jovyan/.local/bin/poetry export --only main --without-hashes -o requirements.txt && \
.env/bin/pip install -r requirements.txt --prefer-binary
Expand All @@ -17,11 +16,11 @@ RUN apt-get update && apt-get install -y \
tini curl git git-lfs && \
rm -rf /var/lib/apt/lists/* && \
groupadd --gid 1000 renku && \
adduser --gid 100 --gid 1000 --uid 1000 jovyan
useradd --gid 100 --gid 1000 --uid 1000 --create-home jovyan
USER 1000:1000
WORKDIR /app
COPY --from=builder /app/.env .env
WORKDIR /home/jovyan/app
COPY --from=builder /home/jovyan/app/.env .env
ADD git_services ./git_services
ENV PATH="${PATH}:/git_services/.venv/bin"
ENV PATH="${PATH}:/home/jovyan/app/.env/bin"
ENTRYPOINT ["tini", "-g", "--"]
CMD [".env/bin/gunicorn", "-c", "git_services/sidecar/gunicorn.conf.py"]

0 comments on commit 0560372

Please sign in to comment.