diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml new file mode 100644 index 0000000..4443300 --- /dev/null +++ b/.github/workflows/build-image.yaml @@ -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 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ca2a754 --- /dev/null +++ b/Dockerfile @@ -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}