Skip to content

Commit

Permalink
new attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ribeiro committed Oct 29, 2024
1 parent 1390165 commit 5b6f53e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,17 @@ RUN apk upgrade --no-cache && \
# Copy your PHP application files into the container
COPY . .

# Copy Nginx configuration
# Copy the main Nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf

# Ensure conf.d directory exists
# Ensure conf.d directory exists and copy the default configuration
RUN mkdir -p /etc/nginx/conf.d

# Copy the default Nginx configuration
COPY nginx.default.conf /etc/nginx/conf.d/default.conf
COPY nginx.default.conf /etc/nginx/conf.d/default.template.conf

# Copy the custom crontab file
COPY cronjobs /etc/cron.d/cronjobs

# Convert the line endings, allow read access to the cron file, and create cron log folder
# Prepare cron configuration and PHP-FPM settings
RUN dos2unix /etc/cron.d/cronjobs && \
chmod 0644 /etc/cron.d/cronjobs && \
/usr/bin/crontab /etc/cron.d/cronjobs && \
Expand All @@ -47,5 +45,5 @@ ENV PORT 80
# Expose the port
EXPOSE ${PORT}

# Start both PHP-FPM, Nginx
CMD ["sh", "-c", "envsubst '${PORT:-80}' < /etc/nginx/conf.d/default.conf > /etc/nginx/conf.d/default.conf && /var/www/html/startup.sh"]
# Substitute the ${PORT} variable in Nginx configs and start services
CMD ["sh", "-c", "envsubst '${PORT:-80}' < /etc/nginx/nginx.conf > /etc/nginx/nginx.conf && envsubst '${PORT:-80}' < /etc/nginx/conf.d/default.template.conf > /etc/nginx/conf.d/default.conf && /var/www/html/startup.sh"]
2 changes: 1 addition & 1 deletion nginx.default.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
server {
listen 80;
listen ${PORT:-80};
server_name your_domain_or_ip; # Change to your domain or IP

root /var/www/html; # Change to your web root directory
Expand Down

0 comments on commit 5b6f53e

Please sign in to comment.