-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Omotayo Obafemi <[email protected]>
- Loading branch information
1 parent
b4aded0
commit 872c895
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Use the official PHP image with CLI | ||
FROM php:8.2-cli | ||
|
||
# Install required extensions and tools | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
unzip \ | ||
libpng-dev \ | ||
libonig-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
curl \ | ||
&& docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd zip | ||
|
||
# Install Node.js and npm | ||
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - \ | ||
&& apt-get install -y nodejs | ||
|
||
# Copy Composer into the image | ||
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer | ||
|
||
# Set working directory | ||
WORKDIR /var/www/whatcompstack-BE | ||
|
||
# Copy application files | ||
COPY . /var/www/whatcompstack-BE | ||
|
||
# Add Git safe directory to avoid "dubious ownership" errors | ||
RUN git config --global --add safe.directory /var/www/whatcompstack-BE | ||
|
||
# Create .env file if it doesn't exist | ||
RUN cp .env.example .env || true | ||
|
||
# Run Composer to install dependencies | ||
RUN composer install | ||
|
||
# Run npm to install frontend dependencies | ||
RUN npm install | ||
|
||
# Set permissions for Laravel | ||
RUN chown -R www-data:www-data /var/www/whatcompstack-BE \ | ||
&& chmod -R 775 /var/www/whatcompstack-BE/storage \ | ||
&& chmod -R 775 /var/www/whatcompstack-BE/bootstrap/cache | ||
|
||
# Run Laravel commands | ||
RUN php artisan key:generate | ||
|
||
# Expose Laravel's default port | ||
EXPOSE 8000 | ||
|
||
# Command to start Laravel's built-in development server | ||
CMD ["php", "artisan", "serve", "--host=0.0.0.0", "--port=8000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: whatcompstack-backend | ||
ports: | ||
- "8000:80" | ||
volumes: | ||
- .:/var/www/whatcompstack-BE | ||
environment: | ||
- APP_ENV=local | ||
- APP_DEBUG=true | ||
- APP_KEY= | ||
- DB_HOST=db | ||
- DB_PORT=3306 | ||
- DB_DATABASE=whatcompstack | ||
- DB_USERNAME=root | ||
- DB_PASSWORD=root | ||
depends_on: | ||
- db | ||
|
||
db: | ||
image: mysql:8.0 | ||
container_name: whatcompstack-db | ||
ports: | ||
- "3306:3306" | ||
environment: | ||
MYSQL_DATABASE: whatcompstack | ||
MYSQL_ROOT_PASSWORD: root | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
|
||
volumes: | ||
db_data: |