Skip to content
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**
!Dockerfile
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
github-actions:
patterns: ['*']
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
ignore:
# Node major versions are selected for each supported platform.
- dependency-name: node
update-types: ['version-update:semver-major']
groups:
docker:
patterns: ['*']
193 changes: 145 additions & 48 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,164 @@
name: Docker Image

on:
schedule:
- cron: "0 15 * * *" # everyday at 3pm
pull_request:
branches: [latest]
push:
branches: ["**"]
tags: ["v*.*.*"]
branches: [latest]
tags: ['v*.*.*']
schedule:
- cron: '0 15 * * *'
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7
IMAGE: beevelop/nodejs-python

jobs:
main:
runs-on: ubuntu-20.04
timeout-minutes: 30
validate:
name: Validate (${{ matrix.platform }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
runner: ubuntu-24.04
cache: amd64
node: '24'
python: '3.13'
- platform: linux/arm64
runner: ubuntu-24.04-arm
cache: arm64
node: '24'
python: '3.13'
- platform: linux/arm/v7
runner: ubuntu-24.04
cache: armv7
node: '22'
python: '3.11'
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set imageName based on the repository name
id: step_one
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up QEMU for 32-bit ARM
if: matrix.platform == 'linux/arm/v7'
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
with:
platforms: arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: Build test image
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: .
platforms: ${{ matrix.platform }}
tags: nodejs-python:smoke
load: true
cache-from: type=gha,scope=validate-${{ matrix.cache }}
cache-to: type=gha,scope=validate-${{ matrix.cache }},mode=min,ignore-error=true
no-cache-filters: ${{ github.event_name == 'schedule' && 'runtime' || '' }}
- name: Exercise Node.js and Python tooling
env:
PLATFORM: ${{ matrix.platform }}
NODE_MAJOR: ${{ matrix.node }}
PYTHON_MINOR: ${{ matrix.python }}
run: |
imageName="${GITHUB_REPOSITORY/docker-/}"
echo $imageName
echo "imageName=$imageName" >> $GITHUB_ENV
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
docker run --rm -i --network none --platform "$PLATFORM" \
-e NODE_MAJOR -e PYTHON_MINOR nodejs-python:smoke /bin/bash -eu <<'SH'
node -e 'if (process.versions.node.split(".")[0] !== process.env.NODE_MAJOR) process.exit(1)'
npm --version
npx --version
yarn --version
python - <<'PY'
import os
import sys
import sysconfig
from pathlib import Path

assert f"{sys.version_info.major}.{sys.version_info.minor}" == os.environ["PYTHON_MINOR"]
assert (Path(sysconfig.get_path("include")) / "Python.h").is_file()
PY
test "$(python --version)" = "$(python3 --version)"
python3 -m pip --version
pip --version
pip3 --version
python -m venv /tmp/venv
/tmp/venv/bin/python -m pip --version
virtualenv --no-download /tmp/virtualenv
/tmp/virtualenv/bin/python -m pip --version
SH

publish:
needs: validate
if: >-
github.actor != 'dependabot[bot]' &&
github.event_name != 'pull_request' &&
(github.ref == 'refs/heads/latest' ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')))
runs-on: ubuntu-24.04
timeout-minutes: 30
permissions:
contents: read
security-events: write
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Generate labels and tags
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: ${{ env.imageName }}
images: ${{ env.IMAGE }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/latest' }}
type=schedule,pattern=nightly
type=ref,event=tag
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
with:
platforms: arm64,arm
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Harbor
uses: docker/login-action@v1
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: Log in to Docker Hub
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Buildx cache
uses: actions/cache@v1
with:
path: ${{ github.workspace }}/cache
key: ${{ runner.os }}-docker-${{ hashfiles('cache/**') }}
restore-keys: |
${{ runner.os }}-docker
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
- name: Build and publish
id: build
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
platforms: ${{ env.platforms }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=${{ github.workspace }}/cache
cache-to: type=local,dest=${{ github.workspace }}/cache
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true
sbom: true
provenance: mode=min
cache-from: |
type=gha,scope=validate-amd64
type=gha,scope=validate-arm64
type=gha,scope=validate-armv7
type=gha,scope=publish
cache-to: type=gha,scope=publish,mode=min,ignore-error=true
no-cache-filters: ${{ github.event_name == 'schedule' && 'runtime' || '' }}
- name: Scan the published digest
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
image-ref: ${{ env.imageName }}:${{ steps.docker_meta.outputs.version }}
format: "template"
template: "@/contrib/sarif.tpl"
output: "trivy-results.sarif"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v1
image-ref: ${{ env.IMAGE }}@${{ steps.build.outputs.digest }}
format: sarif
output: scan.sarif
- name: Upload scan results
uses: github/codeql-action/upload-sarif@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
with:
sarif_file: "trivy-results.sarif"
sarif_file: scan.sarif
40 changes: 34 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
FROM beevelop/nodejs
# syntax=docker/dockerfile:1
# check=error=true
ARG TARGETARCH

RUN apt-get update && \
apt-get install -y python-is-python3 python3 python3-dev python3-pip python3-virtualenv && \
rm -rf /var/lib/apt/lists/* && \
python --version && \
node -v && npm -v
FROM node:24.23.0-trixie-slim@sha256:83079001d4ca6bf276035aa1c7b819b9542fc87a858a4fdc52ccc014bbf92143 AS node-24
FROM node-24 AS node-amd64
FROM node-24 AS node-arm64
# Use Node 22 Bookworm where the official Node 24 images omit arm/v7.
FROM node:22.23.5-bookworm-slim@sha256:be979e5523c76fa4d5ca4ebd3099078f220aa47ec39c48ad5b5df9314debd6eb AS node-arm

FROM node-${TARGETARCH} AS runtime

LABEL org.opencontainers.image.title="Beevelop Node.js and Python" \
org.opencontainers.image.description="Node.js, npm, Yarn Classic, and Debian Python tooling" \
org.opencontainers.image.source="https://github.com/beevelop/docker-nodejs-python" \
org.opencontainers.image.licenses="MIT"

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
curl \
gnupg \
lsb-release \
python-is-python3 \
python3 \
python3-dev \
python3-pip \
python3-venv \
python3-virtualenv \
&& rm -rf /var/lib/apt/lists/*

ENV TERM=xterm

ENTRYPOINT []
CMD ["/bin/bash"]
Loading