diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..6f9493c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,112 @@ +name: ci-docker +on: + pull_request: + branches: + - master + + # Runs on pushes targeting the default branch + push: + branches: ['master'] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +env: + REGISTRY_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/ps3dev + +jobs: + dockerhub-push: + runs-on: ${{ matrix.runner }} + environment: DockerHub + timeout-minutes: 360 + strategy: + fail-fast: false + matrix: + include: + - platform: linux/amd64 + runner: ubuntu-24.04 + - platform: linux/arm64 + runner: ubuntu-24.04-arm + steps: + - name: Prepare + run: | + platform=${{ matrix.platform }} + echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV" + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push by digest + id: build + uses: docker/build-push-action@v6 + with: + context: . + platforms: ${{ matrix.platform }} + outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true + + - name: Export digest + run: | + mkdir -p "${{ runner.temp }}/digests" + digest="${{ steps.build.outputs.digest }}" + touch "${{ runner.temp }}/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v4 + with: + name: digests-${{ env.PLATFORM_PAIR }} + path: ${{ runner.temp }}/digests/* + if-no-files-found: error + retention-days: 1 + + dockerhub-merge: + runs-on: ubuntu-latest + environment: DockerHub + needs: dockerhub-push + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download digests + uses: actions/download-artifact@v4 + with: + path: ${{ runner.temp }}/digests + pattern: digests-* + merge-multiple: true + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Create manifest list and push + working-directory: ${{ runner.temp }}/digests + run: | + docker buildx imagetools create -t "${REGISTRY_IMAGE}:latest" \ + $(printf "${REGISTRY_IMAGE}@sha256:%s " *) + + - name: Inspect image + run: docker buildx imagetools inspect "${REGISTRY_IMAGE}:latest" + + - name: README to Dockerhub + uses: christian-korneck/update-container-description-action@v1 + env: + DOCKER_USER: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKER_PASS: ${{ secrets.DOCKERHUB_TOKEN }} + with: + destination_container_repo: ${{ secrets.DOCKERHUB_USERNAME }}/ps3dev + provider: dockerhub + short_description: 'A Docker Image for PS3 Development' + readme_file: 'README.md' diff --git a/Dockerfile b/Dockerfile index 7d1cbef..71a3955 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,51 @@ FROM debian:13-slim MAINTAINER Naomi Peori -ENV PS3DEV /usr/local/ps3dev -ENV PSL1GHT ${PS3DEV} -ENV PATH ${PATH}:${PS3DEV}/bin:${PS3DEV}/ppu/bin:${PS3DEV}/spu/bin +ENV PS3DEV /usr/local/ps3dev +ENV PSL1GHT $PS3DEV +ENV PATH $PATH:$PS3DEV/bin:$PS3DEV/ppu/bin:$PS3DEV/spu/bin:$PS3DEV/portlibs/ppu/bin +ENV PKG_CONFIG_PATH $PKG_CONFIG_PATH:$PS3DEV/portlibs/ppu/lib/pkgconfig +ENV DEBIAN_FRONTEND=noninteractive -RUN \ - apt-get -y update && \ - apt-get -y install autoconf bison build-essential flex git libelf-dev libgmp3-dev libncurses5-dev libssl-dev libtool-bin pkg-config python-dev-is-python3 texinfo wget zlib1g-dev && \ - apt-get -y clean autoclean autoremove && \ - rm -rf /var/lib/{apt,dpkg,cache,log}/ +RUN apt-get update \ + && apt-get --no-install-recommends install -y \ + autoconf \ + automake \ + bison \ + bzip2 \ + ca-certificates \ + cmake \ + flex \ + gettext-base \ + g++ \ + gcc \ + git \ + libelf-dev \ + libgmp3-dev \ + libncurses5-dev \ + libssl-dev \ + libtool \ + libtool-bin \ + make \ + meson \ + patch \ + pkg-config \ + python-dev-is-python3 \ + texinfo \ + vim \ + wget \ + xz-utils \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* -RUN \ - git clone https://github.com/ps3dev/ps3toolchain.git && \ - cd ps3toolchain && \ - ./toolchain.sh && \ - cd .. && \ - rm -Rf ps3toolchain +# Fixes certificate errors with letsencrypt in ARMv7 +RUN echo "ca_certificate=/etc/ssl/certs/ca-certificates.crt" >> /etc/wgetrc \ + && echo "check_certificate = off" >> /root/.wgetrc \ + && ln -sf "/usr/include/$(gcc -dumpmachine)/gmp.h" /usr/include/gmp.h + +RUN git clone --depth 1 https://github.com/humbertodias/ps3toolchain.git /toolchain \ + && /toolchain/toolchain.sh \ + && rm -rf /toolchain WORKDIR /build +CMD ["/bin/bash"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..27ddc89 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +[![ci-docker](https://github.com/humbertodias/ps3dev-docker/actions/workflows/deploy.yml/badge.svg)](https://github.com/humbertodias/ps3dev-docker/actions/workflows/deploy.yml) +[![](https://images.microbadger.com/badges/image/hldtux/ps3dev.svg)](https://microbadger.com/images/hldtux/ps3dev) +[![](https://img.shields.io/docker/pulls/hldtux/ps3dev.svg?maxAge=604800)](https://hub.docker.com/r/hldtux/ps3dev/) + + +## What does this do? + +This program will automatically build a docker image with the ps3dev +toolchain ready to be used for homebrew development. + +## How do I build it? + +Build the image: + +```sh +docker build -t ps3dev-docker . +``` +Copy the helper script: + +``` +cp ps3dev-docker.sh /usr/local/bin +``` +## How do I use it? + + Use the helper script to run 'make' on the current directory: + +``` +ps3dev-docker.sh make +``` +Or, manually run 'make' on the current directory: + +``` +docker run -v `pwd`:/build ps3dev-docker make +``` + +## How do I save and load it? + +Save the image: + +``` +docker save ps3dev-docker | bzip2 > ps3dev-docker.tar.bz2 +``` +Load the image: + +``` +docker load < bzip2 -dc ps3dev-docker.tar.bz2 +``` diff --git a/readme.txt b/readme.txt deleted file mode 100644 index e7e8069..0000000 --- a/readme.txt +++ /dev/null @@ -1,42 +0,0 @@ - ==================== - What does this do? - ==================== - - This program will automatically build a docker image with the ps3dev - toolchain ready to be used for homebrew development. - - ==================== - How do I build it? - ==================== - - Build the image: - - docker build -t ps3dev-docker . - - Copy the helper script: - - cp ps3dev-docker.sh /usr/local/bin - - ================== - How do I use it? - ================== - - Use the helper script to run 'make' on the current directory: - - ps3dev-docker.sh make - - Or, manually run 'make' on the current directory: - - docker run -v `pwd`:/build ps3dev-docker make - - ============================ - How do I save and load it? - ============================ - - Save the image: - - docker save ps3dev-docker | bzip2 > ps3dev-docker.tar.bz2 - - Load the image: - - docker load < bzip2 -dc ps3dev-docker.tar.bz2