Skip to content

Commit 72033bd

Browse files
feat: docker config (#627)
1 parent 7336af7 commit 72033bd

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM php:7.4-apache
2+
3+
# Install system dependencies and PHP extensions
4+
RUN apt-get update && apt-get install -y \
5+
libpng-dev \
6+
libjpeg-dev \
7+
libfreetype6-dev \
8+
libzip-dev \
9+
libicu-dev \
10+
unzip \
11+
git \
12+
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
13+
&& docker-php-ext-install -j$(nproc) gd mysqli pdo_mysql intl zip \
14+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
15+
16+
# Enable Apache mod_rewrite
17+
RUN a2enmod rewrite
18+
19+
# Install Composer
20+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
21+
22+
# Set working directory
23+
WORKDIR /var/www/html
24+
25+
# Configure Apache DocumentRoot to /var/www/html/public
26+
ENV APACHE_DOCUMENT_ROOT /var/www/html/public
27+
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf
28+
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf
29+
30+
# Salin file composer
31+
COPY composer.json composer.lock ./
32+
33+
# Instal dependensi
34+
RUN composer install --no-dev --optimize-autoloader
35+
36+
# Salin sisa kode aplikasi
37+
COPY . .
38+
39+
# Set permissions for Apache
40+
RUN chown -R www-data:www-data /var/www/html

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
app:
3+
build: .
4+
ports:
5+
- "8080:80"
6+
env_file:
7+
- .env
8+
extra_hosts:
9+
- "host.docker.internal:host-gateway"
10+
volumes:
11+
- ./:/var/www/html
12+
- /var/www/html/donjo-sys

0 commit comments

Comments
 (0)