Compare commits

...

6 Commits

Author SHA1 Message Date
b79281d857 add ci
Some checks failed
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 18s
2025-02-14 05:49:14 +05:00
7d4df39457 ai retarded 2025-02-14 05:44:20 +05:00
58fe310d58 optimize 2025-02-14 04:21:10 +05:00
7fe695785f standerdize dockerfile name 2025-02-14 03:49:56 +05:00
99fccde008 fetch new and build new version automatically 2025-02-14 03:48:31 +05:00
fc5140d237 updated readme with new compose file 2024-06-29 18:42:41 +05:00
10 changed files with 165 additions and 1865 deletions

17
.build/ci-helper Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
VERSION_JSON=$(./get_latest_version.sh)
NEXTCLOUD_VERSION=$(echo $VERSION_JSON | jq -r .version)
NEXTCLOUD_URL=$(echo $VERSION_JSON | jq -r .url)
NEXTCLOUD_FILENAME=$(echo $VERSION_JSON | jq -r .filename)
export NEXTCLOUD_VERSION
export NEXTCLOUD_URL
export NEXTCLOUD_FILENAME
echo "Nextcloud Version: $NEXTCLOUD_VERSION"
echo "Nextcloud URL: $NEXTCLOUD_URL"
echo "Nextcloud Filename: $NEXTCLOUD_FILENAME"
docker compose $@

View File

@ -4,9 +4,11 @@ services:
context: . context: .
dockerfile: fpm.Dockerfile dockerfile: fpm.Dockerfile
args: args:
- VERSION=29.0.3 NEXTCLOUD_VERSION: ${NEXTCLOUD_VERSION}
hostname: fpm NEXTCLOUD_URL: ${NEXTCLOUD_URL}
image: git.shihaam.dev/dockerfiles/nextcloud/fpm:29.0.3 NEXTCLOUD_FILENAME: ${NEXTCLOUD_FILENAME}
hostname: nextcloud
image: git.shihaam.dev/dockerfiles/nextcloud/fpm:${NEXTCLOUD_VERSION}
nginx: nginx:
build: build:
context: . context: .

22
.build/entrypoint.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
if [ ! -f /var/www/html/config/config.php ]; then
touch /var/www/html/config/CAN_INSTALL
cp /var/www/default_config.sample.php /var/www/html/config/config.sample.php
echo "Created /var/www/html/config/CAN_INSTALL and config.sample.php because config.php does not exist."
else
echo "config.php exists. No action taken."
fi
if [ -z "$(ls -A /var/www/html/apps)" ]; then
mkdir -p /var/www/html/apps/
cp -r /var/www/default_apps/* /var/www/html/apps/
echo "Copied default apps to /var/www/html/apps because it was empty."
else
echo "/var/www/html/apps is not empty. No action taken."
fi
## Set permissions
chown -R www-data:www-data /var/www/html/
exec "$@"

View File

@ -1,31 +1,39 @@
FROM git.shihaam.dev/dockerfiles/php-fpm:8.3 FROM git.shihaam.dev/dockerfiles/php-fpm:8.3
LABEL maintainer="Shiham Abdul Rahman <shihaam@shihaam.me>" ARG NEXTCLOUD_VERSION
LABEL org.opencontainers.image.source="https://git.shihaam.dev/dockerfiles/nextcloud" ARG NEXTCLOUD_URL
LABEL org.opencontainers.image.documentation="https://git.shihaam.dev/dockerfiles/nextcloud" ARG NEXTCLOUD_FILENAME
LABEL org.opencontainers.image.description="A simplified docker image for nextcloud"
ARG URL=https://download.nextcloud.com/server/releases/
ARG VERSION
WORKDIR /var/www/html WORKDIR /var/www/html
SHELL ["/bin/bash", "-c"] SHELL ["/bin/bash", "-c"]
# Download, Extract and Delete nextcloud tar.bz2
RUN curl ${URL}nextcloud-${VERSION}.tar.bz2 -o nextcloud-${VERSION}.tar.bz2 \
&& tar -vxjf nextcloud-${VERSION}.tar.bz2 \
&& mv -v nextcloud/* . \
&& rm -rv nextcloud nextcloud-${VERSION}.tar.bz2
# Installing basic tools # Installing basic tools
RUN apt-get update && apt-get install bzip2 zip unzip git gnupg2 ca-certificates lsb-release apt-transport-https wget curl nano vim -y --no-install-recommends \ RUN apt-get update \
&& apt-get install {bzip2,zip,unzip,gnupg2,ca-certificates,lsb-release,apt-transport-https,wget,curl,nano} -y --no-install-recommends \
&& apt-get auto-remove -y \ && apt-get auto-remove -y \
&& apt-get clean -y && apt-get clean -y
# Copy php.ini config # Download, Extract and Delete nextcloud tar.bz2
COPY php.ini /usr/local/etc/php/php.ini RUN wget $NEXTCLOUD_URL \
&& tar -vxjf $NEXTCLOUD_FILENAME \
&& mv -v nextcloud/* . \
&& rm -rv nextcloud $NEXTCLOUD_FILENAME
# Install Php stuff # install php plugins
RUN docker-php-ext-install {gd,mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm} RUN docker-php-ext-install {gd,mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}
## copy default config and apps for setup in entrypoint
RUN mv /var/www/html/config/config.sample.php /var/www/default_config.sample.php \
&& mv /var/www/html/apps/ /var/www/default_apps/
# copy php config
COPY php.ini /usr/local/etc/php/php.ini
COPY php-fpm.conf /usr/local/etc/php-fpm.conf
# copy and setup entrypoint
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
# export volume for nginx to serve static files # export volume for nginx to serve static files
VOLUME /var/www/html VOLUME /var/www/html
CMD ["php-fpm"]

View File

@ -30,7 +30,10 @@ server {
# set max upload size and increase upload timeout: # set max upload size and increase upload timeout:
client_max_body_size 4G; client_max_body_size 4G;
client_body_timeout 600s; client_body_timeout 600s;
fastcgi_buffers 64 4K; fastcgi_buffers 64 16K;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_connect_timeout 300;
# Enable gzip but do not remove ETag headers # Enable gzip but do not remove ETag headers
gzip on; gzip on;

21
.build/php-fpm.conf Normal file
View File

@ -0,0 +1,21 @@
pid = /var/run/php-fpm.pid
error_log = /dev/stderr
emergency_restart_threshold = 10
emergency_restart_interval = 1m
process_control_timeout = 10s
; In www.conf or your pool configuration file
[www]
; Process manager settings
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
; Timeout settings
request_terminate_timeout = 300
[global]
include=etc/php-fpm.d/*.conf

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,37 @@
name: Build and Push Docker Images
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
docker:
name: Build and Push Docker Images
runs-on: builder
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Build Docker images
working-directory: .build/prod
run: docker compose build
- name: Login to Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ vars.DOCKER_REGISTRY_URL }}
username: ${{ vars.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Push Docker images
if: github.event_name != 'pull_request'
working-directory: .build/prod
run: docker compose push

View File

@ -2,35 +2,39 @@
I dont like official nextcloud docker I dont like official nextcloud docker
- `docker-compose.yml` - `compose.yml`
```yaml ```yaml
version: '3.5'
services: services:
######################### fpm:
app: image: git.shihaam.dev/dockerfiles/nextcloud/fpm:latest
image: git.shihaam.dev/dockerfiles/nextcloud hostname: fpm
hostname: nextcloud volumes:
volumes: - ./nextcloud/config:/var/www/html/config:rw
- ./configs/init:/root/init - ./nextcloud/apps:/var/www/html/apps:rw
- ./configs/etc/nginx:/etc/nginx - /mnt/vol0/nextcloud-data:/var/www/html/data:rw
- ./configs/etc/php:/etc/php depends_on:
- ./configs/var/www/html/config:/var/www/html/config - mysql
- ./logs:/root/logs
- ./nextcloud:/var/www/html nginx:
- ./nextcloud-apps:/var/www/html/apps image: git.shihaam.dev/dockerfiles/nextcloud/nginx
- /mnt/hdd/nextcloud-data:/var/www/html/data #CHANGE MOUNT POINT FOR THIS hostname: nginx
ports: ports:
- 8000:80 - 8003:80
######################### volumes_from:
db: - fpm
image: mysql:8 depends_on:
environment: - fpm
MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud mysql:
MYSQL_PASSWORD: nextcloud image: mysql:8.0-debian
MYSQL_ALLOW_EMPTY_PASSWORD: true hostname: mysql
volumes: environment:
- ./database:/var/lib/mysql MYSQL_DATABASE: nextcloud
MYSQL_USER: nextcloud
MYSQL_PASSWORD: nextcloud
MYSQL_ALLOW_EMPTY_PASSWORD: true
volumes:
- ./nextcloud/database:/var/lib/mysql
``` ```
- You must use a reverse proxy with SSL before starting to setup, personally i use nginx with certbot. \ - You must use a reverse proxy with SSL before starting to setup, personally i use nginx with certbot. \
@ -53,5 +57,3 @@ server {
sudo certbot --nginx -d nextcloud.shihaam.me sudo certbot --nginx -d nextcloud.shihaam.me
``` ```
- Configure your DNS accordingly and then.. thats it, enjoy. - Configure your DNS accordingly and then.. thats it, enjoy.