Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Git files
.git
.gitignore
.gitmodules

# Documentation
README.md
CONTRIBUTING.md
CODE_OF_CONDUCT.md
SECURITY.md
LICENSE
LICENSE_NOTICE
docs/
mkdocs_remote.yml

# Development files
.vscode/
.idea/
*.swp
*.swo
*~

# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# PHP dependencies (will be installed via composer in container)
vendor/

# Build artifacts
dist/
build/

# Test files
tests/
test/
phpunit.xml
phpstan.neon

# Development configuration
eslint.config.mjs
gulpfile.mjs
package-lock.json
composer.lock

# Docker files (except the one being built)
docker-compose.yml
Dockerfile.old

# Temporary files
tmp/
temp/
*.tmp

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# IDE files
*.sublime-project
*.sublime-workspace

# Log files
*.log

# Crowdin configuration
crowdin_config.yml

# Installation scripts (may not be needed in container)
install-photobooth.sh
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,25 @@ digicamcontrol/
HEAD
manual/faq.*
node_modules/
private/*

!private/data/.gitkeep
!private/data/images/.gitkeep
!private/data/keying/.gitkeep
!private/data/print/.gitkeep
!private/data/qrcodes/.gitkeep
!private/data/thumbs/.gitkeep
!private/data/test/.gitkeep
!private/data/tmp/.gitkeep

!private/fonts/.gitkeep
!private/images/background/.gitkeep
!private/images/demo/.gitkeep
!private/images/frames/.gitkeep
!private/images/keyingBackgrounds/.gitkeep
!private/images/placeholder/.gitkeep

!private/videos/background/.gitkeep

!private/README.md
resources/css/*
!resources/css/README.md
Expand Down
119 changes: 90 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,97 @@
FROM webdevops/php-apache:8.3
# Use Ubuntu 24.04 as the base image
FROM ubuntu:24.04

# Adjust LimitRequestLine and
# update and install dependencies
RUN echo "LimitRequestLine 12000" > /opt/docker/etc/httpd/conf.d/limits.conf \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
gphoto2 \
libimage-exiftool-perl \
rsync \
udisks2 \
python3 \
ca-certificates \
curl \
gnupg \
nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables to avoid interactive prompts during installation
ENV DEBIAN_FRONTEND=noninteractive

# Copy files
WORKDIR /app
COPY . .
# Install all dependencies, configure system, and clean up in a single layer
RUN apt-get update && apt-get install -y --no-install-recommends \
# Core runtime dependencies
apache2 \
php \
php-cli \
php-mbstring \
php-xml \
php-curl \
php-zip \
php-gd \
gphoto2 \
libimage-exiftool-perl \
rsync \
udisks2 \
python3 \
cups \
ipp-usb \
avahi-daemon \
avahi-utils \
dbus \
printer-driver-gutenprint \
# Build dependencies (will be removed later)
build-essential \
git \
ca-certificates \
curl \
gnupg \
# Install Node.js 20.x
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest \
# Configure www-data user and groups
&& (id -u www-data || useradd -r -s /usr/sbin/nologin www-data) \
&& gpasswd -a www-data plugdev \
&& gpasswd -a www-data lp \
&& gpasswd -a www-data lpadmin \
&& usermod -aG root www-data \
&& mkdir -p /var/www/html \
&& chown -R www-data:www-data /var/www/html \
&& chsh -s /bin/bash www-data \
# Configure Apache
&& a2enmod rewrite \
&& a2enmod headers \
&& echo "LimitRequestLine 12000" > /etc/apache2/conf-available/limits.conf \
&& a2enconf limits \
&& chown -R www-data:www-data /var/www/ \
&& chmod -R 755 /var/www/

RUN chown -R application:application /app
# Switch to the www-data user for building
USER www-data

# switch to application user
USER application
# Set the working directory
WORKDIR /var/www/html

# Install and build
RUN git config --global --add safe.directory /app \
# Clone the Photobooth repository and build the application, then clean up
RUN rm -rf /var/www/html/* \
&& git clone https://github.com/PhotoboothProject/photobooth /var/www/html \
&& cd /var/www/html \
&& git submodule update --init \
&& npm install \
&& npm run build
&& npm run build \
# Clean up after build to reduce image size
&& npm cache clean --force \
&& rm -rf node_modules/.cache \
&& rm -rf .git

# Switch back to root for final configuration
USER root

# Copy configuration script for my Wireless Canon 1500 printer usb printer maybe do not need this
COPY scripts/configure_printer.sh /usr/local/bin/configure_printer.sh

# Remove build dependencies and clean up to reduce image size
RUN apt-get remove -y \
build-essential \
git \
curl \
gnupg \
ca-certificates \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/*

# Expose ports for HTTP and HTTPS
EXPOSE 80 443

# Start Apache in the foreground
CMD dbus-daemon --system --fork & /usr/sbin/ipp-usb & service cups start && apachectl -D FOREGROUND
36 changes: 36 additions & 0 deletions Dockerfile.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM webdevops/php-apache:8.3

# Adjust LimitRequestLine and
# update and install dependencies
RUN echo "LimitRequestLine 12000" > /opt/docker/etc/httpd/conf.d/limits.conf \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
gphoto2 \
libimage-exiftool-perl \
rsync \
udisks2 \
python3 \
ca-certificates \
curl \
gnupg \
nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy files
WORKDIR /app
COPY . .

RUN chown -R application:application /app

# switch to application user
#USER application

# Install and build
RUN git config --global --add safe.directory /app \
&& git submodule update --init \
&& npm install \
&& npm run build
12 changes: 10 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
version: "3.9"

services:
photobooth:
build: .
image: photobox:latest
ports:
- "80:80"
- "443:443"
environment:
- COMPOSER_VERSION=2
volumes:
- ./private/data:/var/www/html/data
- ./private/private:/var/www/html/private
- ./scripts/configure_printer.sh:/usr/local/bin/configure_printer.sh
devices:
- /dev/bus/usb:/dev/bus/usb # Mount USB devices for gphoto2
network_mode: host
privileged: true # Grant elevated privileges for device access
restart: always
2 changes: 2 additions & 0 deletions private/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file ensures the images directory is tracked by Git
# Git doesn't track empty directories, so this file keeps the folder structure
Empty file added private/data/.gitkeep
Empty file.
Empty file added private/data/images/.gitkeep
Empty file.
Empty file added private/data/keying/.gitkeep
Empty file.
Empty file added private/data/print/.gitkeep
Empty file.
Empty file added private/data/qrcodes/.gitkeep
Empty file.
Empty file added private/data/test/.gitkeep
Empty file.
Empty file added private/data/thumbs/.gitkeep
Empty file.
Empty file added private/data/tmp/.gitkeep
Empty file.
Empty file added private/private/.gitkeep
Empty file.
Empty file added private/private/fonts/.gitkeep
Empty file.
2 changes: 2 additions & 0 deletions private/private/images/background/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This file preserves the entire images directory structure
# Including all subdirectories like background/, tmp/, keying/, etc.
Binary file added private/private/images/cheese/owl.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
Empty file.
30 changes: 30 additions & 0 deletions scripts/configure_printer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Start avahi-daemon
echo "Starting avahi-daemon..."
/usr/sbin/avahi-daemon --no-chroot &

# Wait for avahi-daemon to initialize
sleep 10

# Detect the printer's IPP URI
echo "Detecting printer's IPP URI..."
PRINTER_URI=$(lpinfo -v | grep "ipp://" | awk '{print $2}')

if [ -z "$PRINTER_URI" ]; then
echo "No IPP printer detected. Exiting."
exit 1
fi

echo "Printer detected at: $PRINTER_URI"

# Add and configure the Canon SELPHY CP1500 printer using IPP
echo "Configuring the printer..."
lpadmin -p canon -E -v "$PRINTER_URI" -m everywhere
lpoptions -d canon

# Verify the printer configuration
echo "Verifying the printer configuration..."
lpstat -p

# Test lpinfo -v and lpstat -p
Loading