/
Dockerfile
116 lines (93 loc) · 4.42 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# -----------------------------------------------------------------------------------
# COPYRIGHT INFORMATION ...
# HRConvert2, Copyright on 3/12/2024 by Justin Grimes, www.github.com/zelon88
# LICENSE INFORMATION ...
# This project is protected by the GNU GPLv3 Open-Source license.
# https://www.gnu.org/licenses/gpl-3.0.html
# APPLICATION INFORMATION ...
# This application is designed to provide a web-interface for converting file formats
# on a server for users of any web browser without authentication.
# FILE INFORMATION ...
# v3.3.3.
# This file contains the Docker build file for the project.
# Build this with...
# docker build -t HRConvert2 .
# Run this with...
# docker run -d -p 8080:80 -p 8443:443 HRConvert2
# HARDWARE REQUIREMENTS ...
# This application requires at least a Raspberry Pi Model B+ or greater.
# This application will run on just about any x86 or x64 computer.
# DEPENDENCY REQUIREMENTS ...
# This application requires Debian Linux (w/3rd Party audio license),
# Apache 2.4, PHP 8+, LibreOffice, Unoconv, ClamAV, Tesseract, Rar, Unrar, Unzip,
# 7zipper, FFMPEG, PDFTOTEXT, Dia, PopplerUtils, MeshLab, Mkisofs & ImageMagick.
# <3 Open-Source
# -----------------------------------------------------------------------------------
# Build this with...
# docker build -t hrconvert2 .
# Run this with...
# docker run -d -p 8080:80 -p 8443:443 hrconvert2
# Use the official PHP parent image.
FROM php:8.1-apache
# Create required directories.
RUN mkdir /DATA && \
mkdir /DATA/HRConvert2
# Set the working directory in the container.
WORKDIR /var/www/html/HRProprietary
# Create & process a debian.sources file.
RUN apt-get update
# Install git.
RUN apt-get install -y git sed
# Download the latest HRConvert2 source code from the official repository.
RUN git clone https://github.com/zelon88/HRConvert2
# Add non-free repos to software sources. Required for rar support.
# There are two options for accomplishing this.
# Uncomment the option that suits your needs, and comment out the other.
# The first option replaces the debian.sources file.
# The second option modifies the existing debian.sources file in-place.
RUN cp HRConvert2/Documentation/Build/debian.sources /etc/apt/sources.list.d/debian.sources
#RUN sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list.d/debian.sources
# Re-process the updated debian.sources file.
RUN apt-get update
# Install dependencies.
#RUN apt-get upgrade
RUN apt-get install -y zlib1g-dev
RUN apt-get install -y libpng-dev
RUN apt-get install -y libzip-dev
RUN docker-php-ext-install gd zip
RUN apt-get install -y libreoffice-common default-jre libreoffice-java-common poppler-utils
RUN apt-get install -y clamav unoconv p7zip-full meshlab dia pandoc python3 zip unzip ffmpeg
RUN apt-get install -y xpdf mkisofs imagemagick meshlab tesseract-ocr tar
## arm64 rar install hack (rar CLI only available for x86/x64 from rar labs)
RUN DPKG_ARCH="$(dpkg --print-architecture)"; \
if [ "${DPKG_ARCH}" = "amd64" ]; then \
apt-get install -y rar \
else \
dpkg --add-architecture i386 && \
apt-get install qemu-user-static libc6-i386-cross libstdc++6-i386-cross wget -y && \
cp /usr/i686-linux-gnu/lib/libm.so.6 /lib && \
cp /usr/i686-linux-gnu/lib/libc.so.6 /lib && \
cp /usr/i686-linux-gnu/lib/libpthread.so.0 /lib && \
cp /usr/i686-linux-gnu/lib/ld-linux.so.2 /lib && \
cp /usr/i686-linux-gnu/lib/libstdc++.so.6 /lib && \
cp /usr/i686-linux-gnu/lib/libgcc_s.so.1 /lib && \
wget https://www.rarlab.com/rar/rarlinux-x32-700b3.tar.gz -O /tmp/rarlinux-x32-700b3.tar.gz && \
tar -zxvf /tmp/rarlinux-x32-700b3.tar.gz -C /tmp && \
cp HRConvert2/Documentation/Build/rar-arm64 /tmp/rar-arm64 && \
chmod +x /tmp/rar-arm64 && ln -s /tmp/rar-arm64 /usr/bin/rar; \
fi
# Copy required files.
RUN cp HRConvert2/Documentation/Build/php.ini /usr/local/etc/php.ini
RUN cp HRConvert2/index.html /var/www/html/index.html
RUN cp HRConvert2/index.html /var/www/html/HRProprietary/index.html
# Set permissions for required directories.
RUN chmod -R 0755 /DATA && \
chown -R www-data:www-data /DATA && \
chmod -R 0755 /var/www/html && \
chown -R www-data:www-data /var/www/html
# Expose the ports Apache listens on to the host.
# Set these to whatever ports suits your needs.
EXPOSE 80
EXPOSE 443
# Start Apache & Unoconv when the container runs.
CMD ["sh", "-c", "apache2-foreground && python3 /usr/bin/unoconv -l"]