Optimize Pixelfed Dockerfile, add Github Actions build

This commit is contained in:
Kovah 2022-10-30 14:50:35 +01:00 committed by Mehdi Zakaria Benadel (Rebase PR Action)
parent 4ce43f4928
commit 7e8f962db5
2 changed files with 47 additions and 13 deletions

37
.github/workflows/build-docker.yml vendored Normal file
View file

@ -0,0 +1,37 @@
---
name: Build Docker image
on:
push:
branches:
- dev
jobs:
build_regular_docker:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./contrib/docker/Dockerfile.apache
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: kovah/pixelfed-docker:latest

View file

@ -1,20 +1,17 @@
FROM php:7.4-apache-bullseye
FROM php:8.0-apache
ENV COMPOSER_MEMORY_LIMIT=-1
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /var/www/
# Use the default production configuration
COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
# Install Composer
ENV COMPOSER_VERSION=2.1.14 \
COMPOSER_HOME=/var/www/.composer \
COMPOSER_MEMORY_LIMIT=-1 \
PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
ARG DEBIAN_FRONTEND=noninteractive
WORKDIR /var/www/
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
&& curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig \
&& php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" \
&& php /tmp/composer-setup.php --no-ansi --install-dir=/usr/local/bin --filename=composer --version=${COMPOSER_VERSION} && rm -rf /tmp/composer-setup.php \
&& apt-get update \
# Get Composer binary
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# Install package dependencies
RUN apt-get update \
&& apt-get upgrade -y \
# && apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y --no-install-recommends \