Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbarry committed Feb 20, 2024
1 parent 6739adf commit 584f5c4
Show file tree
Hide file tree
Showing 12 changed files with 6,362 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gitignore
.dockerignore
.env
Dockerfile
README.md
27 changes: 27 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Docker image

on:
push:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Log in to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/${{ github.repository }}/cgmsharp:latest
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM php:8.3.3-apache

RUN apt-get update && apt-get install -y \
exif \
ffmpeg \
libzip-dev \
libpng-dev \
libjpeg-dev \
sudo \
zip \
libfreetype6-dev \
libfontconfig1-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-install zip \
&& docker-php-ext-install exif

RUN apt-get clean

ARG UID=1026
ARG GID=101

# By default apache runs as the www-data user (uid: 33) if this doesn't match the dockerhost user that has permissions on the mapped volume
# the container won't be able to access the host file system. Force the uid for the www-data user to match the user id on docker host that
# can access the mapped volume. (1026 & 101)
RUN usermod --non-unique -u ${UID} www-data
RUN groupmod --non-unique -g ${GID} www-data

# copy files-gallery into container
COPY src/index.php /var/www/html

# customise settings
COPY src/_filesconfig.php /var/www/html/_filesconfig.php

# setup write permissions on /media
RUN mkdir -p /media \
&& mkdir -p /config \
&& chmod -R 755 /media \
&& chmod -R 755 /config \
&& chown -R www-data:www-data /media \
&& chown -R www-data:www-data /config
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# files-gallery
Docker image to run https://www.files.gallery/
# Files-Gallery

Docker container for https://www.files.gallery/ - a single-file PHP app that can be dropped into any folder, instantly creating a gallery of files and folders.

When running this container, your images directory should be mounted into the container's `/media` directory, files.gallery listens on port 80.
80 changes: 80 additions & 0 deletions config/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

// CONFIG / https://www.files.gallery/docs/config/
// Uncomment the parameters you want to edit.
return array (
//'root' => '',
//'start_path' => false,
//'username' => '',
//'password' => '',
//'load_images' => true,
//'load_files_proxy_php' => false,
//'load_images_max_filesize' => 1000000,
//'image_resize_enabled' => true,
//'image_resize_cache' => true,
//'image_resize_dimensions' => 320,
//'image_resize_dimensions_retina' => 480,
//'image_resize_dimensions_allowed' => '',
//'image_resize_types' => 'jpeg, png, gif, webp, bmp, avif',
//'image_resize_quality' => 85,
//'image_resize_function' => 'imagecopyresampled',
//'image_resize_sharpen' => true,
//'image_resize_memory_limit' => 128,
//'image_resize_max_pixels' => 30000000,
//'image_resize_min_ratio' => 1.5,
//'image_resize_cache_direct' => false,
//'folder_preview_image' => true,
//'folder_preview_default' => '_filespreview.jpg',
//'menu_enabled' => true,
//'menu_show' => true,
//'menu_max_depth' => 5,
//'menu_sort' => 'name_asc',
//'menu_cache_validate' => true,
//'menu_load_all' => false,
//'menu_recursive_symlinks' => true,
//'layout' => 'rows',
//'sort' => 'name_asc',
//'sort_dirs_first' => true,
//'sort_function' => 'locale',
//'cache' => true,
//'cache_key' => 0,
//'storage_path' => '_files',
//'files_exclude' => '',
//'dirs_exclude' => '',
//'allow_symlinks' => true,
//'title' => '%name% [%count%]',
//'history' => true,
//'transitions' => true,
//'click' => 'popup',
//'click_window' => '',
//'click_window_popup' => true,
//'code_max_load' => 100000,
//'topbar_sticky' => 'scroll',
//'check_updates' => false,
//'allow_tasks' => false,
//'get_mime_type' => false,
//'context_menu' => true,
//'prevent_right_click' => false,
//'license_key' => '',
//'filter_live' => true,
//'filter_props' => 'name, filetype, mime, features, title',
//'download_dir' => 'browser',
//'download_dir_cache' => 'dir',
//'assets' => '',
//'allow_upload' => false,
//'allow_delete' => false,
//'allow_rename' => false,
//'allow_new_folder' => false,
//'allow_new_file' => false,
//'allow_duplicate' => false,
//'allow_text_edit' => false,
//'demo_mode' => false,
//'upload_allowed_file_types' => '',
//'upload_max_filesize' => 0,
//'upload_exists' => 'increment',
//'popup_video' => true,
//'video_thumbs' => true,
//'video_ffmpeg_path' => 'ffmpeg',
//'lang_default' => 'en',
//'lang_auto' => true,
);
14 changes: 14 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.8'
services:
app:
container_name: files-gallery
hostname: files.gallery.local # not used, but without it apache will complain about unknown fqdn on startup
build: .
ports:
- "8080:80"
volumes:
- ./config:/config
- C:\pictures:/media

volumes:
config:
16 changes: 16 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.8'
services:
app:
image: ghcr.io/marcbarry/files-gallery/files-gallery:latest
container_name: files-gallery
restart: 'unless-stopped'
hostname: files.gallery.local # not used, but without it apache will complain about unknown fqdn on startup
ports:
- "8080:80"
volumes:
- ./config:/config
- ./media:/media

volumes:
config:
media:
Loading

0 comments on commit 584f5c4

Please sign in to comment.