diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 0000000000..76a4f8f203 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,26 @@ +name: Build and Push OMP to Docker Hub + +on: + push: + branches: [ private1 ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: recursive # penting untuk OMP! + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: amirul123/omp diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..3e31dfa1c4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,69 @@ +# ============================================================ +# Dockerfile untuk Open Monograph Press (OMP) +# CARA GUNA: GitHub Actions akan COPY kod ke dalam image +# JANGAN clone dalam Dockerfile — guna COPY sahaja +# ============================================================ + +FROM php:8.2-apache + +# Install dependencies +RUN apt-get update && apt-get install -y \ + unzip \ + curl \ + libpng-dev \ + libjpeg-dev \ + libfreetype6-dev \ + libzip-dev \ + libicu-dev \ + libxml2-dev \ + libonig-dev \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install \ + gd \ + pdo \ + pdo_mysql \ + mysqli \ + zip \ + intl \ + xml \ + mbstring \ + bcmath \ + opcache \ + ftp \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Composer +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Set working directory +WORKDIR /var/www/html + +# COPY kod dari GitHub Actions (bukan clone) +COPY . . + +# Install PHP dependencies +RUN composer install -d lib/pkp --no-dev --optimize-autoloader --no-interaction + +# Buat direktori yang diperlukan +RUN mkdir -p \ + cache/t_cache \ + cache/t_config \ + cache/t_compile \ + cache/_db \ + && chown -R www-data:www-data /var/www/html \ + && chmod -R 755 /var/www/html \ + && chmod -R 777 cache + +# Enable Apache mod_rewrite +RUN a2enmod rewrite + +# Apache config +RUN printf '\n\ + Options FollowSymLinks\n\ + AllowOverride All\n\ + Require all granted\n\ +\n' > /etc/apache2/conf-available/omp.conf \ + && a2enconf omp + +EXPOSE 80 +CMD ["apache2-foreground"]