diff mbox series

docker: rebase on vicamo/pyenv

Message ID 20211212061740.3015597-1-vicamo@gmail.com
State Accepted
Headers show
Series docker: rebase on vicamo/pyenv | expand

Commit Message

You-Sheng Yang Dec. 12, 2021, 6:17 a.m. UTC
Rebuild pyenv environments can be time-consuming and irrelevant to this
project. Use a prebuild image to save some time here.

Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
---
 tools/docker/Dockerfile | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

Comments

You-Sheng Yang Dec. 12, 2021, 6:56 a.m. UTC | #1
You-Sheng Yang <vicamo@gmail.com> 於 2021年12月12日 週日 下午2:17寫道:
>
> Rebuild pyenv environments can be time-consuming and irrelevant to this
> project. Use a prebuild image to save some time here.

This saves 10 minutes CI duration for those docker-compose test jobs.
You may want to fork these pyenv images for stability concerns if you
feel this change is appropriate.

> diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
> index d9d0905..821ad37 100644
> --- a/tools/docker/Dockerfile
> +++ b/tools/docker/Dockerfile
> @@ -1,4 +1,4 @@
> -FROM ubuntu:18.04
> +FROM vicamo/pyenv:latest-bionic
>
>  ARG UID
>  ARG GID
Stephen Finucane Dec. 22, 2021, 10:05 p.m. UTC | #2
On Sun, 2021-12-12 at 14:17 +0800, You-Sheng Yang wrote:
> Rebuild pyenv environments can be time-consuming and irrelevant to this
> project. Use a prebuild image to save some time here.
> 
> Signed-off-by: You-Sheng Yang <vicamo@gmail.com>

This is a good idea. I've created a similar image at [1] which (I think) will do
the same thing, simply so we can quickly iterate on it if we need to in the
future. Let me know if you spot anything amiss. If not, I'll merge this (with
the different base image) next week.

Thanks again,
Stephen

[1] https://github.com/getpatchwork/pyenv/
You-Sheng Yang Dec. 23, 2021, 4:16 a.m. UTC | #3
Stephen Finucane <stephen@that.guru> 於 2021年12月23日 週四 上午6:05寫道:
>
> On Sun, 2021-12-12 at 14:17 +0800, You-Sheng Yang wrote:
> > Rebuild pyenv environments can be time-consuming and irrelevant to this
> > project. Use a prebuild image to save some time here.
> >
> > Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
>
> This is a good idea. I've created a similar image at [1] which (I think) will do
> the same thing, simply so we can quickly iterate on it if we need to in the
> future. Let me know if you spot anything amiss. If not, I'll merge this (with
> the different base image) next week.

I think that looks good to me.

For those `apt-cache search` lines, I was to cover some major
Debian/Ubuntu releases. You might not need them.

Besides, while python3.10 is out and 3.11 is coming, I was personally
trying to rewrite a bit to allow automatic builds of newly available
python versions in my own repo. Add some build argument to the build
stage of the Dockerfile allows you to test that. Taking a step
further, split build stage as builder and build-all stages as I did in
[1], then you have a handy image for manual testing. Pretty convenient
for me.

[1]:https://github.com/vicamo/docker-pyenv/blob/5159e6c94d2f173f6bcc3759448ce5dea228ab08/Dockerfile-debian.template
Stephen Finucane Feb. 22, 2022, 3 p.m. UTC | #4
On Thu, 2021-12-23 at 12:16 +0800, You-Sheng Yang wrote:
> Stephen Finucane <stephen@that.guru> 於 2021年12月23日 週四 上午6:05寫道:
> > 
> > On Sun, 2021-12-12 at 14:17 +0800, You-Sheng Yang wrote:
> > > Rebuild pyenv environments can be time-consuming and irrelevant to this
> > > project. Use a prebuild image to save some time here.
> > > 
> > > Signed-off-by: You-Sheng Yang <vicamo@gmail.com>
> > 
> > This is a good idea. I've created a similar image at [1] which (I think) will do
> > the same thing, simply so we can quickly iterate on it if we need to in the
> > future. Let me know if you spot anything amiss. If not, I'll merge this (with
> > the different base image) next week.
> 
> I think that looks good to me.

Thanks for looking at this. I completely forgot about it /o\ I've applied this
now.

> For those `apt-cache search` lines, I was to cover some major
> Debian/Ubuntu releases. You might not need them.

Good point. I stripped those (and added a credit linking back to your project)

> Besides, while python3.10 is out and 3.11 is coming, I was personally
> trying to rewrite a bit to allow automatic builds of newly available
> python versions in my own repo. Add some build argument to the build
> stage of the Dockerfile allows you to test that. Taking a step
> further, split build stage as builder and build-all stages as I did in
> [1], then you have a handy image for manual testing. Pretty convenient
> for me.

Thanks for the tips. I'll take a look into doing this. We need to do some work
on our supported Python versions for Patchwork proper so align nicely.

Thanks again,
Stephen

> 
> [1]:https://github.com/vicamo/docker-pyenv/blob/5159e6c94d2f173f6bcc3759448ce5dea228ab08/Dockerfile-debian.template
diff mbox series

Patch

diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index d9d0905..821ad37 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -1,4 +1,4 @@ 
-FROM ubuntu:18.04
+FROM vicamo/pyenv:latest-bionic
 
 ARG UID
 ARG GID
@@ -10,11 +10,6 @@  RUN echo $UID; echo $GID; \
     [ -n "$GID" ] || { echo "You must define GID in .env" 1>&2; exit 1; }
 
 ARG TZ="Australia/Canberra"
-ENV LANG="C.UTF-8"
-ENV LC_ALL="C.UTF-8"
-ENV PATH="/opt/pyenv/shims:/opt/pyenv/bin:$PATH"
-ENV PYENV_ROOT="/opt/pyenv"
-ENV PYENV_SHELL="bash"
 ENV DEBIAN_FRONTEND noninteractive
 ENV PYTHONUNBUFFERED 1
 ENV PROJECT_HOME /home/patchwork/patchwork
@@ -25,34 +20,15 @@  RUN groupadd --gid=$GID patchwork && \
 RUN rm -f /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
 
 RUN apt-get update && apt-get install -y --no-install-recommends \
-    build-essential \
-    ca-certificates \
-    curl \
-    git \
-    libbz2-dev \
-    libffi-dev \
     libmysqlclient-dev \
     libpq-dev \
-    libreadline-dev \
     libsqlite3-dev \
-    libssl-dev \
     mysql-client \
     postgresql-client \
     sqlite3 \
     tzdata \
-    zlib1g-dev \
     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 
-RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \
-    git clone https://github.com/momo-lab/xxenv-latest $PYENV_ROOT/plugins/xxenv-latest && \
-    pyenv update
-
-RUN pyenv latest install 3.6 && \
-    pyenv latest install 3.7 && \
-    pyenv latest install 3.8 && \
-    pyenv latest install 3.9
-RUN pyenv global $(pyenv versions --bare | tac)
-
 RUN pip install tox tox-pyenv
 
 # we deliberately leave the requirements files in /opt so we can ping the user