Skip to content

Commit

Permalink
enable new design in docker (no alpine yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
sstidl committed Oct 19, 2024
1 parent c7e3fcc commit a6e5241
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 2 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ RUN mkdir -p /speedtest/

# Copy sources
COPY backend/ /speedtest/backend
COPY frontend/ /speedtest/frontend

COPY results/*.php /speedtest/results/
COPY results/*.ttf /speedtest/results/
Expand Down
64 changes: 64 additions & 0 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM php:8-alpine

# Install extensions
RUN apk add --quiet --no-cache \
bash \
apache2 \
apache2-ssl \
php83-apache2 \
php83-ctype \
php83-openssl \
php-gd php-session php-sqlite3 \
php-pdo php-pgsql php83-pdo_mysql php-pdo_pgsql php-pdo_sqlite \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libpq-dev \
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
&& docker-php-ext-configure pgsql -with-pgsql=/usr/local/pgsql \
&& docker-php-ext-install -j$(nproc) gd pdo pdo_mysql pdo_pgsql pgsql \
&& rm -f /usr/src/php.tar.xz /usr/src/php.tar.xz.asc \
&& apk del --quiet --no-cache \
freetype-dev \
libjpeg-turbo-dev \
libpng-dev \
libpq-dev

#RUN ln -sf /dev/stdout /var/log/apache2/access.log && \
# ln -sf /dev/stderr /var/log/apache2/error.log
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/1 /var/log/apache2/error.log


# Prepare files and folders
RUN mkdir -p /speedtest/

# Copy sources
COPY backend/ /speedtest/backend

COPY results/*.php /speedtest/results/
COPY results/*.ttf /speedtest/results/

COPY *.js /speedtest/
COPY favicon.ico /speedtest/

COPY docker/servers.json /servers.json

COPY docker/*.php /speedtest/
COPY docker/entrypoint.sh /

# Prepare default environment variables
ENV TITLE=LibreSpeed
ENV MODE=standalone
ENV PASSWORD=password
ENV TELEMETRY=false
ENV ENABLE_ID_OBFUSCATION=false
ENV REDACT_IP_ADDRESSES=false
ENV WEBPORT=80

# https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop
STOPSIGNAL SIGWINCH

# Final touches
EXPOSE 80
CMD ["bash", "/entrypoint.sh"]
5 changes: 3 additions & 2 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ fi

# Set up index.php for frontend-only or standalone modes
if [[ "$MODE" == "frontend" || "$MODE" == "dual" ]]; then
cp /speedtest/frontend.php /var/www/html/index.php
cp -av /speedtest/frontend/* /var/www/html/
elif [ "$MODE" == "standalone" ]; then
cp /speedtest/standalone.php /var/www/html/index.php
cp -av /speedtest/frontend/* /var/www/html/
echo '[{"name":"local","server":"/backend", "dlURL": "garbage.php", "ulURL": "empty.php", "pingURL": "empty.php", "getIpURL": "getIP.php", "sponsorName": "", "sponsorURL": "", "id":1 }]' > /var/www/html/server-list.json
fi

# Apply Telemetry settings when running in standalone or frontend mode and telemetry is enabled
Expand Down

0 comments on commit a6e5241

Please sign in to comment.