OiO.lk Blog PHP Dockerizing PHP (Smarty) and SQLite3 Project
PHP

Dockerizing PHP (Smarty) and SQLite3 Project


I’m trying to Dockerize my PHP (Smarty) and SQLite3 website but am encountering issues with my Dockerfile and Docker Compose configuration.

Here’s a summary of my Dockerfile setup (I’ve trimmed it down to the essential parts):

dockerfile

Copy code
FROM php:8.2.0-apache

# Install dependencies
RUN apt-get update && apt-get install -y libzip-dev unzip curl sqlite3 libsqlite3-dev
RUN docker-php-ext-install zip pdo pdo_sqlite

# Set working directory
WORKDIR /var/www/html/

# Copy project files
COPY ./templates ./templates
# ... other COPY commands

# Set permissions
RUN chown -R www-data:www-data /var/www/html

# Enable Apache mod_rewrite
RUN a2enmod rewrite

CMD ["apache2-foreground"]

And here’s my compose.yaml file:

services:
  web:
    build: .
    container_name: corporate_site_web
    ports:
      - "8000:80"
    networks:
      - corporate_site_network

networks:
  corporate_site_network:
    driver: bridge

volumes:
  db-compose-volume:

I would appreciate any guidance on fixing my setup as I’m new to Docker and struggling to get it to work. Thank you!



You need to sign in to view this answers

Exit mobile version