Giter Club home page Giter Club logo

pyjdk's Introduction

Python3 and OpenJDK on Ubuntu

Overview

This repository manages the customised Docker image build of Python3 on Ubuntu. You can target any Python 3 verions against any Ubuntu release. Just follow the makester settings below.

Bypassing the Docker Hub Official Image Python image build is much more work, but gives us more flexibility to address CVEs.

The image build process is based on GitHub Python project's Docker build with a switch to Ubuntu base. Not sure why there isn't a Ubuntu variant available in the Official Python images?

Quick Links

Prerequisites

Getting Started

Makester is used as the Integrated Developer Platform.

(macOS Users only) Upgrading GNU Make

Follow these notes to get GNU make.

Creating the Local Environment

Get the code and change into the top level git project directory:

git clone https://github.com/loum/pyjdk.git && cd pyjdk

NOTE: Run all commands from the top-level directory of the git repository.

For first-time setup, get the Makester project:

git submodule update --init

Initialise the environment:

make init

Local Environment Maintenance

Keep Makester project up-to-date with:

git submodule update --remote --merge

Help

There should be a make target to be able to get most things done. Check the help for more information:

make help

Docker Image Development and Management

Building the Image

NOTE: Ubuntu base image is jammy 22.04

Build the image with:

make image-buildx

Searching Images

To list the available Docker images::

make image-search

Image Tagging

By default, makester will tag the new Docker image with the current branch hash. This provides a degree of uniqueness but is not very intuitive. That is where the image-tag-version Makefile target can help. To apply tag as per project tagging convention <ubuntu-code>-<python3-version>-<image-release-number>:

make image-tag-version

Sample output:

### Tagging container image "loum/pyjdk" as "python3.10-openjdk11-1"

To tag the image as latest

make image-tag-latest

Sample output:

### Tagging container image "loum/pyjdk" as "latest"

To tag the image main line (without the <image-release-number> that ensures the latest Ubuntu release:

make image-tag-main

Sample output:

### Tagging container image "loum/pyjdk" as "python3.10-openjdk11"

Building the Image with a different Python 3 version

During the image build, a fresh compile of the Python binaries is performed. In theory, any Python release under https://www.python.org/ftp/python/ can be used. You will need to supply the PYTHON_MAJOR_MINOR_VERSION to the image build target. For example, to build an image with the latest Python 3.9:

PYTHON_MAJOR_MINOR_VERSION=3.9 make image-buildx

To validate the image runs as expected:

make container-run

By default, the container-run target will drop you into the Python REPL:

Python 3.9.16 (main, Jan 29 2023, 10:42:18)
[GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

On success this will drop you into the Python interpreter.

Interact with the loum/pyjdk Image

The container-run target is a convenience action that will drop into the Python REPL of the current image build:

make container-run

To get the container image Python version:

make container-run CMD=--version

NOTE: Override the CMD variable to pass any CLI options to the Python executable.

PySpark REPL

PySpark is not installed by default. This is to keep the image size as small as possible. However, the environment is ready to support a PySpark install. loum/pyjdk can serve as a base image for your larger project. If you only want a quick and simple PySpark REPL, then provide a PySpark version to the BUILD_PYSPARK_VERSION environment variable:

BUILD_PYSPARK_VERSION=3.3.1 m container-run

Without a CMD, this will drop you into the PySpark REPL:

Successfully installed py4j-0.10.9.5 pyspark-3.3.1
Welcome to
      ____              __
     / __/__  ___ _____/ /__
    _\ \/ _ \/ _ `/ __/  '_/
   /___/ .__/\_,_/_/ /_/\_\   version 3.3.1
      /_/

Using Scala version 2.12.15, OpenJDK 64-Bit Server VM, 11.0.17
Branch HEAD
Compiled by user yumwang on 2022-10-15T09:47:01Z
Revision fbbcf9434ac070dd4ced4fb9efe32899c6db12a9
Url https://github.com/apache/spark
Type --help for more information.

top

pyjdk's People

Contributors

loum avatar

Watchers

 avatar  avatar

pyjdk's Issues

Support for Docker multi-platform builds

Is your feature request related to a problem? Please describe.

I'm building my images on linux/arm64 but also want these to support linux/amd64.

Describe the solution you would like.

See Leverage multi-CPU architecture support.

Describe alternatives you have considered.

Building images manually, but that's a pain.

Additional context

Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.