mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-19 21:11:26 +00:00
commit
344d145e76
6 changed files with 920 additions and 810 deletions
121
.github/workflows/build-docker.yml
vendored
Normal file
121
.github/workflows/build-docker.yml
vendored
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
---
|
||||||
|
name: Build Docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/build-docker.yml
|
||||||
|
- contrib/docker/Dockerfile.apache
|
||||||
|
- contrib/docker/Dockerfile.fpm
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-docker-apache:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Docker Lint
|
||||||
|
uses: hadolint/hadolint-action@v3.0.0
|
||||||
|
with:
|
||||||
|
dockerfile: contrib/docker/Dockerfile.apache
|
||||||
|
failure-threshold: error
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
|
||||||
|
- name: Fetch tags
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKER_HUB_ORGANISATION }}/pixelfed
|
||||||
|
flavor: |
|
||||||
|
latest=auto
|
||||||
|
suffix=-apache
|
||||||
|
tags: |
|
||||||
|
type=edge,branch=dev
|
||||||
|
type=pep440,pattern={{raw}}
|
||||||
|
type=pep440,pattern=v{{major}}.{{minor}}
|
||||||
|
type=ref,event=pr
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: contrib/docker/Dockerfile.apache
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
build-docker-fpm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Docker Lint
|
||||||
|
uses: hadolint/hadolint-action@v3.0.0
|
||||||
|
with:
|
||||||
|
dockerfile: contrib/docker/Dockerfile.fpm
|
||||||
|
failure-threshold: error
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
|
||||||
|
- name: Fetch tags
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
id: meta
|
||||||
|
with:
|
||||||
|
images: ${{ secrets.DOCKER_HUB_ORGANISATION }}/pixelfed
|
||||||
|
flavor: |
|
||||||
|
suffix=-fpm
|
||||||
|
tags: |
|
||||||
|
type=edge,branch=dev
|
||||||
|
type=pep440,pattern={{raw}}
|
||||||
|
type=pep440,pattern=v{{major}}.{{minor}}
|
||||||
|
type=ref,event=pr
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: contrib/docker/Dockerfile.fpm
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
builder: ${{ steps.buildx.outputs.name }}
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
541
composer.lock
generated
541
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,20 +1,14 @@
|
||||||
FROM php:7.4-apache-bullseye
|
FROM php:8.1-apache-bullseye
|
||||||
|
|
||||||
# Use the default production configuration
|
ENV COMPOSER_MEMORY_LIMIT=-1
|
||||||
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
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
WORKDIR /var/www/
|
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 \
|
# Get Composer binary
|
||||||
&& 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); }" \
|
COPY --from=composer:2.4.4 /usr/bin/composer /usr/bin/composer
|
||||||
&& 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 \
|
# Install package dependencies
|
||||||
|
RUN apt-get update \
|
||||||
&& apt-get upgrade -y \
|
&& apt-get upgrade -y \
|
||||||
# && apt-get install -y --no-install-recommends apt-utils \
|
# && apt-get install -y --no-install-recommends apt-utils \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
|
@ -24,8 +18,8 @@ RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
|
||||||
git \
|
git \
|
||||||
gosu \
|
gosu \
|
||||||
zip \
|
zip \
|
||||||
unzip \
|
unzip \
|
||||||
libzip-dev \
|
libzip-dev \
|
||||||
libcurl4-openssl-dev \
|
libcurl4-openssl-dev \
|
||||||
## Image Optimization
|
## Image Optimization
|
||||||
optipng \
|
optipng \
|
||||||
|
@ -89,12 +83,18 @@ RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer \
|
||||||
&& rm -rf /var/cache/apt \
|
&& rm -rf /var/cache/apt \
|
||||||
&& rm -rf /var/lib/apt/lists/
|
&& rm -rf /var/lib/apt/lists/
|
||||||
|
|
||||||
|
# Use the default production configuration
|
||||||
|
COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
|
||||||
|
|
||||||
COPY . /var/www/
|
COPY . /var/www/
|
||||||
# for detail why storage is copied this way, pls refer to https://github.com/pixelfed/pixelfed/pull/2137#discussion_r434468862
|
# for detail why storage is copied this way, pls refer to https://github.com/pixelfed/pixelfed/pull/2137#discussion_r434468862
|
||||||
RUN cp -r storage storage.skel \
|
RUN cp -r storage storage.skel \
|
||||||
&& composer install --prefer-dist --no-interaction --no-ansi --optimize-autoloader \
|
&& composer install --prefer-dist --no-interaction --no-ansi --optimize-autoloader \
|
||||||
&& rm -rf html && ln -s public html \
|
&& rm -rf html && ln -s public html \
|
||||||
&& chown -R www-data:www-data /var/www
|
&& chown -R www-data:www-data /var/www
|
||||||
|
|
||||||
|
RUN php artisan horizon:publish
|
||||||
|
|
||||||
VOLUME /var/www/storage /var/www/bootstrap
|
VOLUME /var/www/storage /var/www/bootstrap
|
||||||
|
|
||||||
CMD ["/var/www/contrib/docker/start.apache.sh"]
|
CMD ["/var/www/contrib/docker/start.apache.sh"]
|
||||||
|
|
|
@ -1,29 +1,25 @@
|
||||||
FROM php:7.4-fpm-buster
|
FROM php:8.1-fpm-bullseye
|
||||||
|
|
||||||
# Use the default production configuration
|
ENV COMPOSER_MEMORY_LIMIT=-1
|
||||||
COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
WORKDIR /var/www/
|
||||||
|
|
||||||
# Install Composer
|
# Get Composer binary
|
||||||
ENV COMPOSER_VERSION 1.9.2
|
COPY --from=composer:2.4.4 /usr/bin/composer /usr/bin/composer
|
||||||
ENV COMPOSER_HOME /var/www/.composer
|
|
||||||
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
|
|
||||||
|
|
||||||
# Update OS Packages
|
# Install package dependencies
|
||||||
RUN apt-get update
|
RUN apt-get update \
|
||||||
|
&& apt-get upgrade -y \
|
||||||
# Install OS Packages
|
# && apt-get install -y --no-install-recommends apt-utils \
|
||||||
RUN apt-get install -y --no-install-recommends apt-utils
|
&& apt-get install -y --no-install-recommends \
|
||||||
RUN apt-get install -y --no-install-recommends \
|
|
||||||
## Standard
|
## Standard
|
||||||
locales locales-all \
|
locales \
|
||||||
|
locales-all \
|
||||||
git \
|
git \
|
||||||
gosu \
|
gosu \
|
||||||
zip \
|
zip \
|
||||||
unzip \
|
unzip \
|
||||||
libzip-dev \
|
libzip-dev \
|
||||||
libcurl4-openssl-dev \
|
libcurl4-openssl-dev \
|
||||||
## Image Optimization
|
## Image Optimization
|
||||||
optipng \
|
optipng \
|
||||||
|
@ -33,62 +29,62 @@ RUN apt-get install -y --no-install-recommends \
|
||||||
## Image Processing
|
## Image Processing
|
||||||
libjpeg62-turbo-dev \
|
libjpeg62-turbo-dev \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
|
libmagickwand-dev \
|
||||||
# Required for GD
|
# Required for GD
|
||||||
libxpm4 \
|
libxpm4 \
|
||||||
libxpm-dev \
|
libxpm-dev \
|
||||||
libwebp6 \
|
libwebp6 \
|
||||||
libwebp-dev \
|
libwebp-dev \
|
||||||
## Video Processing
|
## Video Processing
|
||||||
ffmpeg
|
ffmpeg \
|
||||||
|
## Database
|
||||||
# Update Local data
|
# libpq-dev \
|
||||||
RUN sed -i '/en_US/s/^#//g' /etc/locale.gen && locale-gen && update-locale
|
# libsqlite3-dev \
|
||||||
|
mariadb-client \
|
||||||
|
# Locales Update
|
||||||
|
&& sed -i '/en_US/s/^#//g' /etc/locale.gen \
|
||||||
|
&& locale-gen \
|
||||||
|
&& update-locale \
|
||||||
# Install PHP extensions
|
# Install PHP extensions
|
||||||
RUN docker-php-source extract
|
&& docker-php-source extract \
|
||||||
|
|
||||||
#PHP Imagemagick extensions
|
#PHP Imagemagick extensions
|
||||||
RUN apt-get install -y --no-install-recommends libmagickwand-dev
|
&& pecl install imagick \
|
||||||
RUN pecl install imagick
|
&& docker-php-ext-enable imagick \
|
||||||
RUN docker-php-ext-enable imagick
|
|
||||||
|
|
||||||
# PHP GD extensions
|
# PHP GD extensions
|
||||||
RUN docker-php-ext-configure gd \
|
&& docker-php-ext-configure gd \
|
||||||
--with-freetype \
|
--with-freetype \
|
||||||
--with-jpeg \
|
--with-jpeg \
|
||||||
--with-webp \
|
--with-webp \
|
||||||
--with-xpm
|
--with-xpm \
|
||||||
RUN docker-php-ext-install -j$(nproc) gd
|
&& docker-php-ext-install -j$(nproc) gd \
|
||||||
|
|
||||||
#PHP Redis extensions
|
#PHP Redis extensions
|
||||||
RUN pecl install redis
|
&& pecl install redis \
|
||||||
RUN docker-php-ext-enable redis
|
&& docker-php-ext-enable redis \
|
||||||
|
|
||||||
#PHP Database extensions
|
#PHP Database extensions
|
||||||
RUN apt-get install -y --no-install-recommends libpq-dev libsqlite3-dev
|
&& docker-php-ext-install pdo_mysql \
|
||||||
RUN docker-php-ext-install pdo_mysql pdo_pgsql pdo_sqlite
|
#pdo_pgsql pdo_sqlite \
|
||||||
|
|
||||||
#PHP extensions (dependencies)
|
#PHP extensions (dependencies)
|
||||||
RUN docker-php-ext-configure intl
|
&& docker-php-ext-configure intl \
|
||||||
RUN docker-php-ext-install -j$(nproc) intl bcmath zip pcntl exif curl
|
&& docker-php-ext-install -j$(nproc) intl bcmath zip pcntl exif curl \
|
||||||
|
|
||||||
#Cleanup
|
#Cleanup
|
||||||
RUN docker-php-source delete
|
&& docker-php-source delete \
|
||||||
RUN apt-get autoremove --purge -y
|
&& apt-get autoremove --purge -y \
|
||||||
RUN rm -rf /var/cache/apt
|
&& apt-get clean \
|
||||||
RUN rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/cache/apt \
|
||||||
|
&& rm -rf /var/lib/apt/lists/
|
||||||
|
|
||||||
ENV PATH="~/.composer/vendor/bin:./vendor/bin:${PATH}"
|
# Use the default production configuration
|
||||||
|
COPY contrib/docker/php.production.ini "$PHP_INI_DIR/php.ini"
|
||||||
|
|
||||||
COPY . /var/www/
|
COPY . /var/www/
|
||||||
WORKDIR /var/www/
|
# for detail why storage is copied this way, pls refer to https://github.com/pixelfed/pixelfed/pull/2137#discussion_r434468862
|
||||||
|
RUN cp -r storage storage.skel \
|
||||||
|
&& composer install --prefer-dist --no-interaction --no-ansi --optimize-autoloader \
|
||||||
|
&& rm -rf html && ln -s public html \
|
||||||
|
&& chown -R www-data:www-data /var/www
|
||||||
|
|
||||||
RUN cp -r storage storage.skel
|
RUN php artisan horizon:publish
|
||||||
RUN composer global require hirak/prestissimo --no-interaction --no-suggest --prefer-dist
|
|
||||||
RUN composer install --prefer-dist --no-interaction --no-ansi --optimize-autoloader
|
|
||||||
RUN composer global remove hirak/prestissimo
|
|
||||||
RUN rm -rf html && ln -s public html
|
|
||||||
|
|
||||||
VOLUME /var/www/storage /var/www/bootstrap
|
VOLUME /var/www/storage /var/www/bootstrap
|
||||||
|
|
||||||
CMD ["/var/www/contrib/docker/start.fpm.sh"]
|
CMD ["/var/www/contrib/docker/start.fpm.sh"]
|
||||||
|
|
|
@ -14,10 +14,7 @@ services:
|
||||||
## App and Worker
|
## App and Worker
|
||||||
app:
|
app:
|
||||||
# Comment to use dockerhub image
|
# Comment to use dockerhub image
|
||||||
build:
|
image: pixelfed/pixelfed:latest
|
||||||
context: .
|
|
||||||
dockerfile: contrib/docker/Dockerfile.apache
|
|
||||||
image: pixelfed
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- .env.docker
|
- .env.docker
|
||||||
|
@ -35,10 +32,7 @@ services:
|
||||||
- redis
|
- redis
|
||||||
|
|
||||||
worker:
|
worker:
|
||||||
build:
|
image: pixelfed/pixelfed:latest
|
||||||
context: .
|
|
||||||
dockerfile: contrib/docker/Dockerfile.apache
|
|
||||||
image: pixelfed
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
env_file:
|
env_file:
|
||||||
- .env.docker
|
- .env.docker
|
||||||
|
|
920
package-lock.json
generated
920
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue