Skip to content

Commit

Permalink
feat(image): Add Dockerfile
Browse files Browse the repository at this point in the history
# Issue

The `devxci/mbtci-java21-node22` image does not contain the tools
necessary to build and scan Python-based apps.
On the other hand the image already contains all tools to run `mbt` and
perform scans using `piper`.

# Fix

Add `python3`, `pip` and `pipx` to image to enable building and scanning
Python-based apps.
  • Loading branch information
silvestre committed Sep 24, 2024
1 parent b572439 commit 4bf20d4
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true # ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
tags: ghcr.io/${{ github.repository }}:latest
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Use the base image
FROM devxci/mbtci-java21-node22

ARG MTA_USER="mta"

# Switch to root user to install packages
USER root

# Install python3, pip, pipx
RUN apt-get update && \
apt-get install -y python3 python3-pip python3-venv && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
pip install pipx && \
python3 --version && pip --version && pipx --version

# Switch back to the original user
USER ${MTA_USER}

0 comments on commit 4bf20d4

Please sign in to comment.