R
Railwayβ€’5mo ago
Jack

Migrate dockerfile commands to start command

Migrating use of a repo with a Dockerfile for my Wordpress template, however encountered issues on the way. Dockerfile:
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
RUN echo "DirectoryIndex index.php index.html" >> /etc/apache2/apache2.conf

# Set the maximum upload file size directly in the PHP configuration
RUN echo "upload_max_filesize = $SIZE_LIMIT" >> /usr/local/etc/php/php.ini
RUN echo "post_max_size = $SIZE_LIMIT" >> /usr/local/etc/php/php.ini

CMD ["apache2-foreground"]
RUN echo "ServerName 0.0.0.0" >> /etc/apache2/apache2.conf
RUN echo "DirectoryIndex index.php index.html" >> /etc/apache2/apache2.conf

# Set the maximum upload file size directly in the PHP configuration
RUN echo "upload_max_filesize = $SIZE_LIMIT" >> /usr/local/etc/php/php.ini
RUN echo "post_max_size = $SIZE_LIMIT" >> /usr/local/etc/php/php.ini

CMD ["apache2-foreground"]
Start command (doesnt respond after "Restarting Apache httpd web server: apache2"):
/bin/bash -c "echo 'ServerName 0.0.0.0' >> /etc/apache2/apache2.conf && echo 'DirectoryIndex index.php index.html' >> /etc/apache2/apache2.conf && echo 'upload_max_filesize = 50M' >> /usr/local/etc/php/php.ini && echo 'post_max_size = 50M' >> /usr/local/etc/php/php.ini && chown -R www-data:www-data /var/www/ && a2enmod rewrite && apache2ctl configtest && service apache2 restart"
/bin/bash -c "echo 'ServerName 0.0.0.0' >> /etc/apache2/apache2.conf && echo 'DirectoryIndex index.php index.html' >> /etc/apache2/apache2.conf && echo 'upload_max_filesize = 50M' >> /usr/local/etc/php/php.ini && echo 'post_max_size = 50M' >> /usr/local/etc/php/php.ini && chown -R www-data:www-data /var/www/ && a2enmod rewrite && apache2ctl configtest && service apache2 restart"
17 Replies
Percy
Percyβ€’5mo ago
Project ID: 867ebcce-09dd-4523-ae77-356c262de86f
Jack
Jackβ€’5mo ago
867ebcce-09dd-4523-ae77-356c262de86f
Brody
Brodyβ€’5mo ago
PORT=80
WORDPRESS_DB_HOST=${{MariaDB.MARIADB_PRIVATE_HOST}}:${{MariaDB.MARIADB_PRIVATE_PORT}}
WORDPRESS_DB_NAME=${{MariaDB.MARIADB_DATABASE}}
WORDPRESS_DB_PASSWORD=${{MariaDB.MARIADB_PASSWORD}}
WORDPRESS_DB_USER=${{MariaDB.MARIADB_USER}}
WORDPRESS_AUTH_KEY=${{secret(32)}}
WORDPRESS_SECURE_AUTH_KEY=${{secret(32)}}
WORDPRESS_LOGGED_IN_KEY=${{secret(32)}}
WORDPRESS_NONCE_KEY=${{secret(32)}}
WORDPRESS_AUTH_SALT=${{secret(32)}}
WORDPRESS_SECURE_AUTH_SALT=${{secret(32)}}
WORDPRESS_LOGGED_IN_SALT=${{secret(32)}}
WORDPRESS_NONCE_SALT=${{secret(32)}}
PORT=80
WORDPRESS_DB_HOST=${{MariaDB.MARIADB_PRIVATE_HOST}}:${{MariaDB.MARIADB_PRIVATE_PORT}}
WORDPRESS_DB_NAME=${{MariaDB.MARIADB_DATABASE}}
WORDPRESS_DB_PASSWORD=${{MariaDB.MARIADB_PASSWORD}}
WORDPRESS_DB_USER=${{MariaDB.MARIADB_USER}}
WORDPRESS_AUTH_KEY=${{secret(32)}}
WORDPRESS_SECURE_AUTH_KEY=${{secret(32)}}
WORDPRESS_LOGGED_IN_KEY=${{secret(32)}}
WORDPRESS_NONCE_KEY=${{secret(32)}}
WORDPRESS_AUTH_SALT=${{secret(32)}}
WORDPRESS_SECURE_AUTH_SALT=${{secret(32)}}
WORDPRESS_LOGGED_IN_SALT=${{secret(32)}}
WORDPRESS_NONCE_SALT=${{secret(32)}}
/bin/bash -c "echo 'ServerName 0.0.0.0' >> /etc/apache2/apache2.conf && echo 'DirectoryIndex index.php index.html' >> /etc/apache2/apache2.conf && echo 'upload_max_filesize = 50M' >> /usr/local/etc/php/php.ini && echo 'post_max_size = 50M' >> /usr/local/etc/php/php.ini && docker-entrypoint.sh apache2-foreground"
/bin/bash -c "echo 'ServerName 0.0.0.0' >> /etc/apache2/apache2.conf && echo 'DirectoryIndex index.php index.html' >> /etc/apache2/apache2.conf && echo 'upload_max_filesize = 50M' >> /usr/local/etc/php/php.ini && echo 'post_max_size = 50M' >> /usr/local/etc/php/php.ini && docker-entrypoint.sh apache2-foreground"
Jack
Jackβ€’5mo ago
tysm
Brody
Brodyβ€’5mo ago
no problem!
Jack
Jackβ€’5mo ago
Error establishing a database connection :(
Brody
Brodyβ€’5mo ago
are you using the variables I sent?
Jack
Jackβ€’5mo ago
yeah, just didnt change the database ones
Brody
Brodyβ€’5mo ago
the database ones are the most important lol
Jack
Jackβ€’5mo ago
cause i alr have them
Brody
Brodyβ€’5mo ago
one of yours was wrong πŸ˜‰
Jack
Jackβ€’5mo ago
oh i see 😭 i thought that was the database type seeing it was called mysql in their docs
Brody
Brodyβ€’5mo ago
fair assumption
Jack
Jackβ€’5mo ago
brody a real one <:Pray_For_That:921144633155780698>
Brody
Brodyβ€’5mo ago
hey, do you think you could add this variable to your template? https://gist.github.com/brody192/d5c130581f8ace1ee82d1fb6e846bed3
Jack
Jackβ€’5mo ago
How do I have it generate a discussion thread for the template?
Brody
Brodyβ€’5mo ago
for old templates, just update something about it hey @Jack - think you can do this when you got the time?