diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f15fccb..f652ea2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,9 +16,10 @@ jobs: uses: actions/checkout@v2 - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v1 + uses: crazy-max/ghaction-docker-buildx@v2 with: buildx-version: latest + skip-cache: false qemu-version: latest - name: Dockerhub login diff --git a/.github/workflows/tags.yml b/.github/workflows/tags.yml deleted file mode 100644 index 4f6ed3a..0000000 --- a/.github/workflows/tags.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: tags - -on: - push: - tags: - - '*' - -jobs: - tags: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v2 - - - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v1 - with: - buildx-version: latest - qemu-version: latest - - - name: Dockerhub login - env: - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin - - - name: Get tag name - id: tag_name - run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} - - - name: Run Buildx - env: - TAG: ${{ steps.tag_name.outputs.TAG }} - run: | - docker buildx build \ - --pull \ - --push \ - --platform linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64 \ - --tag magicalex/rtorrent-cleaner:"${TAG}" . diff --git a/Dockerfile b/Dockerfile index 8334fbc..047e48e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,26 @@ +FROM alpine:3.12 AS builder + +RUN apk add --no-progress --no-cache \ + curl \ + git \ + php7 \ + php7-ctype \ + php7-iconv \ + php7-json \ + php7-mbstring \ + php7-openssl \ + php7-phar \ + php7-simplexml \ + php7-tokenizer \ + php7-xmlrpc \ + && cd /tmp \ + && curl -s http://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ + && chmod +x /usr/local/bin/composer \ + && git clone https://github.com/Magicalex/rtorrent-cleaner.git /tmp/rtorrent-cleaner \ + && cd /tmp/rtorrent-cleaner \ + && composer build \ + && mv rtorrent-cleaner-php7.2.phar /usr/local/bin/rtorrent-cleaner + FROM alpine:3.12 LABEL description="rtorrent-cleaner is a tool to clean up unnecessary files in rtorrent" \ @@ -5,6 +28,8 @@ LABEL description="rtorrent-cleaner is a tool to clean up unnecessary files in r ENV PHP_MEMORY_LIMIT=128M PHP_TIMEZONE=UTC +COPY --from=builder /usr/local/bin /usr/local/bin + RUN apk add --no-progress --no-cache \ php7 \ php7-iconv \ @@ -14,8 +39,6 @@ RUN apk add --no-progress --no-cache \ php7-xmlrpc \ && sed -i 's/memory_limit = .*/memory_limit = ${PHP_MEMORY_LIMIT}/' /etc/php7/php.ini \ && sed -i 's/;date.timezone =/date.timezone = ${PHP_TIMEZONE}/' /etc/php7/php.ini \ - && wget https://github.com/Magicalex/rtorrent-cleaner/releases/download/0.9.7/rtorrent-cleaner-php7.2.phar \ - && mv rtorrent-cleaner-php7.2.phar /usr/local/bin/rtorrent-cleaner \ && chmod +x /usr/local/bin/rtorrent-cleaner ENTRYPOINT ["rtorrent-cleaner"]