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

Replace Alpine with a Python (3.10) base image for CKAN 2.10 and master branches #61

Merged
merged 21 commits into from
Jun 27, 2024

Conversation

kowh-ai
Copy link
Contributor

@kowh-ai kowh-ai commented May 10, 2024

Fixes: #54

The objective is to upgrade from the alpine 2.17 base image to an official DockerHub Python 3.10 base image. We opted for a Debian 12 (bookworm slim) base image.

No alterations have been made to the current CKAN 2.9 builds.

Efforts were made to streamline the system libraries to only include essential components.

Upon successful testing and integration of this PR, several improvements will be realized:

  • Implementation of Multi-Stage Builds, assuming it reduces image size and increases image security
  • Optimization of Docker Layers and subsequent caching mechanisms
  • Enhancements to render the base image more suitable for production environments
  • Assess the feasibility of substituting Supervisor with a native Docker Compose (or Docker) approach for managing CKAN process restarts.
  • Fix: Running "ckan -c ckan.ini db upgrade" on master fails #60

I'm happy to take suggestions for better naming of files and images

@kowh-ai
Copy link
Contributor Author

kowh-ai commented May 10, 2024

@EricSoroos - if you get a chance would you please be able to take a look at this?

@wardi wardi self-assigned this May 21, 2024
@amercader amercader self-assigned this May 28, 2024
ckan-2.10/base/Dockerfile.python.3.10 Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@@ -0,0 +1,62 @@
#!/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this file have any difference with the current start_ckan.sh? If not I think it would be great to avoid duplication, we have a lot of it already in this repo!

Copy link
Contributor Author

@kowh-ai kowh-ai Jun 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes a couple of changes, probably the most significant one is that the python.3.10 one sets up a virtual environment

Screenshot 2024-06-04 at 4 27 42 pm

There's a change to the USWGI options too

Also, the start_ckan.python.3.10.sh file is copied as start_ckan.sh (ie: renamed)

@kowh-ai
Copy link
Contributor Author

kowh-ai commented Jun 5, 2024

@amercader - Iv'e updated filenames, image names...got consistent with using ..-py3.. rather than python

kowh-ai and others added 2 commits June 10, 2024 15:34
Copy link
Member

@amercader amercader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wardi can you share the approach you mentioned to autoactivate the venv when running a command in the container? cheers

ckan-2.10/base/Dockerfile.py-3.10 Outdated Show resolved Hide resolved
ckan-2.10/base/Dockerfile.py-3.10 Outdated Show resolved Hide resolved
ckan-2.10/base/Makefile Outdated Show resolved Hide resolved
@wardi
Copy link
Contributor

wardi commented Jun 17, 2024

@wardi can you share the approach you mentioned to autoactivate the venv when running a command in the container? cheers

Yes we can use https://docs.docker.com/reference/dockerfile/#entrypoint to run commands before other run commands etc. I used this in an old docker config to reset the UID of the ckan user to match the one from the mounted directory, become the ckan user and activate the virtualenv

@kowh-ai
Copy link
Contributor Author

kowh-ai commented Jun 18, 2024

@amercader - I have committed your suggested change to rename the Dockerfile (for python) to remove the "dash" - Just confirming that this is what you want as I will need to update a few more things - thanks

Screenshot 2024-06-18 at 1 30 16 pm

@amercader
Copy link
Member

@kowh-ai yes, this way is consistent with the tag ending in py3.10

@amercader
Copy link
Member

@kowh-ai can you bring the new Dockerfile based on python:3.10-slim-bookworm to a stage where this issue occurs? It will be easier to decide what to do this way

I can't imagine that this issue hasn't been solved somehow on the official Python images

@kowh-ai
Copy link
Contributor Author

kowh-ai commented Jun 25, 2024

@amercader - I was unsuccessful is recreating the pip issue using the python/bookworm base image. I'm really not sure why...anyway Iv'e made changes (commented out any venv lines) built all the images (locally) and tested. Maybe you could confirm they work and then we take it from there...

@amercader amercader marked this pull request as draft June 27, 2024 07:35
@amercader amercader merged commit 537bc85 into main Jun 27, 2024
@amercader amercader deleted the use-python-3.10-as-the-base-image branch June 27, 2024 10:56
@amercader amercader mentioned this pull request Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants