Skip to content

Commit a2a50f2

Browse files
committed
single container working
1 parent 62bf6d6 commit a2a50f2

30 files changed

+1971
-850
lines changed

REMOVED_AUTO_HTTPS_PREFIX.md

Lines changed: 0 additions & 176 deletions
This file was deleted.

WebInterface/.env

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,64 @@
1-
# Database Configuration
1+
# =========================================================
2+
# AI MultiBarcode Capture - Unified Container Configuration
3+
# =========================================================
4+
#
5+
# This configuration controls the unified multibarcode-webinterface container
6+
# which includes Apache+PHP, MySQL, and phpMyAdmin in a single image.
7+
#
8+
# After modifying this file, restart the services:
9+
# ./start-services.sh (Linux/macOS)
10+
# start-services.bat (Windows)
11+
#
12+
13+
# =========================================================
14+
# SERVICE PORTS
15+
# =========================================================
16+
17+
# Web Management System (WMS) Interface Port
18+
# This is the main dashboard where you monitor barcode sessions
19+
# Access: http://localhost:3500
20+
WEB_PORT=3500
21+
22+
# =========================================================
23+
# OPTIONAL SERVICE EXPOSURE
24+
# =========================================================
25+
26+
# Enable phpMyAdmin Interface (set to true to expose)
27+
# Web-based database administration interface
28+
# Access: http://localhost:3500/phpmyadmin (when enabled)
29+
EXPOSE_PHPMYADMIN=false
30+
31+
# MySQL Database Access (always internal only in unified container)
32+
# Direct database access not exposed externally for security
33+
EXPOSE_MYSQL=false
34+
35+
# =========================================================
36+
# DATABASE CONFIGURATION
37+
# =========================================================
38+
39+
# Database Connection Settings
240
DB_HOST=db
341
DB_NAME=barcode_wms
442
DB_USER=wms_user
543
DB_PASS=wms_password
644

7-
# MySQL Root Password
45+
# MySQL Root Password (for administrative access)
846
MYSQL_ROOT_PASSWORD=root_password
947

10-
# Web Server Configuration
11-
WEB_PORT=8080
12-
PHPMYADMIN_PORT=8081
13-
MYSQL_PORT=3306
48+
# =========================================================
49+
# COMMON PORT ALTERNATIVES
50+
# =========================================================
51+
#
52+
# If default ports are in use, try these alternatives:
53+
#
54+
# WEB_PORT=8080 # Default
55+
# WEB_PORT=8090 # Alternative if 8080 is busy
56+
# WEB_PORT=9080 # Alternative if 8090 is busy
57+
#
58+
# PHPMYADMIN_PORT=8081 # Default
59+
# PHPMYADMIN_PORT=8091 # Alternative if 8081 is busy
60+
# PHPMYADMIN_PORT=9081 # Alternative if 8091 is busy
61+
#
62+
# MYSQL_PORT=3306 # Default
63+
# MYSQL_PORT=3307 # Alternative if 3306 is busy
64+
# MYSQL_PORT=3308 # Alternative if 3307 is busy

WebInterface/Dockerfile

Lines changed: 66 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,81 @@
1-
FROM php:8.2-apache
1+
# Unified Docker Image for AI MultiBarcode Capture
2+
# Contains Apache+PHP, MySQL, and phpMyAdmin in a single container
23

3-
# Install system dependencies
4+
FROM ubuntu:22.04
5+
6+
# Prevent interactive prompts during package installation
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
9+
# Install all required packages
410
RUN apt-get update && apt-get install -y \
5-
git \
11+
apache2 \
12+
php8.1 \
13+
php8.1-mysql \
14+
libapache2-mod-php8.1 \
15+
php8.1-curl \
16+
php8.1-cli \
17+
php8.1-mbstring \
18+
php8.1-xml \
19+
php8.1-zip \
20+
mysql-server \
21+
mysql-client \
22+
wget \
623
curl \
7-
libpng-dev \
8-
libonig-dev \
9-
libxml2-dev \
10-
zip \
11-
unzip \
24+
supervisor \
25+
nano \
1226
&& rm -rf /var/lib/apt/lists/*
1327

14-
# Install PHP extensions
15-
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
16-
17-
# Enable Apache modules
18-
RUN a2enmod rewrite headers expires ssl
28+
# Install phpMyAdmin
29+
RUN wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz \
30+
&& tar xzf phpMyAdmin-5.2.1-all-languages.tar.gz \
31+
&& mv phpMyAdmin-5.2.1-all-languages /var/www/html/phpmyadmin \
32+
&& rm phpMyAdmin-5.2.1-all-languages.tar.gz
1933

20-
# Copy custom Apache configuration
34+
# Configure Apache
35+
RUN a2enmod rewrite headers expires env
2136
COPY apache/000-default.conf /etc/apache2/sites-available/000-default.conf
22-
COPY apache/ssl-default.conf /etc/apache2/sites-available/ssl-default.conf
2337

24-
# Generate SSL certificates inside container
25-
RUN mkdir -p /etc/ssl/certs /etc/ssl/private && \
26-
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
27-
-keyout /etc/ssl/private/wms.key \
28-
-out /etc/ssl/certs/wms.crt \
29-
-subj "/C=US/ST=State/L=City/O=WMS/CN=wms.local" \
30-
-addext "subjectAltName=DNS:localhost,DNS:wms.local,IP:127.0.0.1,IP:192.168.1.188" && \
31-
chmod 600 /etc/ssl/private/wms.key && \
32-
chmod 644 /etc/ssl/certs/wms.crt
38+
# Configure phpMyAdmin
39+
COPY phpmyadmin/config.inc.php /var/www/html/phpmyadmin/config.inc.php
3340

34-
# Enable SSL site
35-
RUN a2ensite ssl-default
41+
# Configure MySQL
42+
COPY mysql/my.cnf /etc/mysql/conf.d/custom.cnf
3643

37-
# Set working directory
38-
WORKDIR /var/www/html
39-
40-
# Copy application source
44+
# Copy application source code
4145
COPY src/ /var/www/html/
4246

43-
# Set proper permissions
44-
RUN chown -R www-data:www-data /var/www/html \
47+
# Copy database initialization script
48+
COPY database/init.sql /tmp/init.sql
49+
50+
# Create necessary directories first
51+
RUN mkdir -p /scripts
52+
53+
# Copy startup script and fix line endings
54+
COPY startup.sh /startup.sh
55+
RUN sed -i 's/\r$//' /startup.sh && chmod +x /startup.sh
56+
57+
# Create necessary directories and set permissions
58+
RUN mkdir -p /var/run/mysqld \
59+
&& mkdir -p /var/log/supervisor \
60+
&& mkdir -p /var/log/mysql \
61+
&& mkdir -p /var/log/apache2 \
62+
&& mkdir -p /scripts \
63+
&& chown mysql:mysql /var/run/mysqld \
64+
&& chown mysql:mysql /var/lib/mysql \
65+
&& chown -R www-data:www-data /var/www/html \
4566
&& chmod -R 755 /var/www/html
4667

47-
# Expose port 80
48-
EXPOSE 80
68+
# Initialize MySQL data directory (if not already done)
69+
RUN service mysql start && sleep 5 && service mysql stop || true
70+
71+
# Environment variables with defaults
72+
ENV MYSQL_ROOT_PASSWORD=
73+
ENV MYSQL_DATABASE=barcode_wms
74+
ENV MYSQL_USER=wms_user
75+
ENV MYSQL_PASSWORD=wms_password
76+
77+
# Expose ports (will be dynamic based on WEB_PORT)
78+
EXPOSE 3500
4979

50-
CMD ["apache2-foreground"]
80+
# Start the services
81+
CMD ["/startup.sh"]

0 commit comments

Comments
 (0)