docker
Some checks failed
Build and Publish Docker Images / build-and-push (push) Failing after 6m30s
Test Docker Compose Setup / test-compose (push) Failing after 30s
Test Docker Compose Setup / lint-dockerfiles (push) Failing after 34s
Test Docker Compose Setup / validate-compose (push) Failing after 12s
Build and Publish Docker Images / security-scan (push) Has been skipped
Build and Publish Docker Images / notify (push) Failing after 7s
Some checks failed
Build and Publish Docker Images / build-and-push (push) Failing after 6m30s
Test Docker Compose Setup / test-compose (push) Failing after 30s
Test Docker Compose Setup / lint-dockerfiles (push) Failing after 34s
Test Docker Compose Setup / validate-compose (push) Failing after 12s
Build and Publish Docker Images / security-scan (push) Has been skipped
Build and Publish Docker Images / notify (push) Failing after 7s
This commit is contained in:
39
Web/Dockerfile
Normal file
39
Web/Dockerfile
Normal file
@@ -0,0 +1,39 @@
|
||||
# Use PHP 8.2 Apache for web backend
|
||||
FROM php:8.2-apache
|
||||
|
||||
# Install required PHP extensions
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libcurl4-openssl-dev \
|
||||
pkg-config \
|
||||
libssl-dev \
|
||||
&& docker-php-ext-install curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Enable Apache mod_rewrite
|
||||
RUN a2enmod rewrite
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /var/www/html
|
||||
|
||||
# Copy PHP application
|
||||
COPY back-end.php .
|
||||
|
||||
# Create non-root user for security
|
||||
RUN groupadd -g 1001 phpapp && \
|
||||
useradd -r -u 1001 -g phpapp phpapp
|
||||
|
||||
# Change ownership
|
||||
RUN chown -R phpapp:phpapp /var/www/html
|
||||
|
||||
# Switch to non-root user
|
||||
USER phpapp
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost/back-end.php || exit 1
|
||||
|
||||
# Start Apache
|
||||
CMD ["apache2-foreground"]
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
// Define the URL and API key for the metrics endpoint
|
||||
$url = '<yourURL>/metrics'; //your URL
|
||||
$url = $_ENV['UPTIME_KUMA_URL'] ?? '<yourURL>/metrics'; //your URL
|
||||
// Retrieve an API key from the UptimeKuma dashboard here <yourURL>/settings/api-keys
|
||||
$password = '***************'; //your API key
|
||||
$password = $_ENV['UPTIME_KUMA_API_KEY'] ?? '***************'; //your API key
|
||||
|
||||
$username = ''; //leave empty
|
||||
// Initialize a new cURL session
|
||||
|
||||
Reference in New Issue
Block a user