diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d717bdb..86a19b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,56 +8,34 @@ on: jobs: buildx: - runs-on: ubuntu-latest + runs-on: ubuntu-18.04 steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v2 - - - name: Prepare - id: prepare - run: | - DOCKER_IMAGE=caronc/apprise - DOCKER_PLATFORMS=linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/386 - VERSION=edge - if [[ $GITHUB_REF == refs/tags/* ]]; then - VERSION=${GITHUB_REF#refs/tags/v} - fi + - name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: ${{ secrets.DOCKER_HUB_REPO }} - TAGS="--tag ${DOCKER_IMAGE}:${VERSION}" - if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then - TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest" - fi + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 - echo ::set-output name=docker_image::${DOCKER_IMAGE} - echo ::set-output name=version::${VERSION} - echo ::set-output name=buildx_args::--platform ${DOCKER_PLATFORMS} \ - --build-arg VERSION=${VERSION} \ - --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ - --build-arg VCS_REF=${GITHUB_SHA::8} \ - ${TAGS} . - - - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v3 - - - name: Docker Buildx (build) - run: | - docker buildx build --output "type=image,push=false" ${{ steps.prepare.outputs.buildx_args }} - - - name: Login to DockerHub - if: success() && github.event_name != 'pull_request' + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub uses: docker/login-action@v1 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Docker Buildx (push) - if: success() && github.event_name != 'pull_request' - run: | - docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }} - - - name: Inspect image - if: always() && github.event_name != 'pull_request' - run: | - docker buildx imagetools inspect ${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }} + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64,linux/386,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index a030eaa..62594d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,13 +12,13 @@ ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV APPRISE_CONFIG_DIR /config +# Install nginx and supervisord +RUN apt-get update -qq && \ + apt-get install -y -qq nginx supervisor build-essential libffi-dev libssl-dev python-dev rustc + # Install requirements and gunicorn COPY ./requirements.txt /etc/requirements.txt -RUN pip3 install -r /etc/requirements.txt gunicorn - -# Install nginx and supervisord -RUN apt-get update && \ - apt-get install -y nginx supervisor +RUN pip3 install -qq -r /etc/requirements.txt gunicorn # Nginx configuration RUN echo "daemon off;" >> /etc/nginx/nginx.conf @@ -39,6 +39,12 @@ COPY apprise_api/ webapp # Change port of gunicorn RUN sed -i -e 's/:8000/:8080/g' /opt/apprise/webapp/gunicorn.conf.py +# Cleanup +RUN apt-get remove -y -qq build-essential libffi-dev libssl-dev python-dev rustc && \ + apt-get clean autoclean && \ + apt-get autoremove --yes && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ + EXPOSE 8000 VOLUME /config