From 7b5eb030af296fbe42e36dc4389d64e6bef37e17 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 9 Aug 2023 10:01:11 +0800 Subject: [PATCH] Initial commit --- .github/workflows/deploy.yml | 36 ++++++++++++++++++++++ Dockerfile | 59 ++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..54e19d9 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: Deploy to ECR + +on: + push: + branches: [ main ] + workflow_dispatch: + +jobs: + build: + name: Build Image + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v2 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ap-south-1 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: andrewnicols/moodlehq/production_template_pgsql + IMAGE_TAG: latest + run: | + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..34691ff --- /dev/null +++ b/Dockerfile @@ -0,0 +1,59 @@ +############################################################################ +# PHP Extension configuration +############################################################################ +# Install the following extensions. +# Note: This line must come before the FROM line. +ARG PHP_EXTENSIONS="apcu pgsql bz2 imagick igbinary gd intl imap" + +############################################################################ +# Source image selection +############################################################################ +# Build the image from thecodingmachine. +FROM thecodingmachine/php:8.1-v4-slim-apache + +# If using the Apache image in production, switch the user back to www-data. +# https://github.com/thecodingmachine/docker-images-php#using-this-image-in-production +ENV APACHE_RUN_USER=www-data \ + APACHE_RUN_GROUP=www-data + +############################################################################ +# PHP Configuration +############################################################################ +# Set any php.ini settings here. +# Use the production php.ini file as a base. +ENV TEMPLATE_PHP_INI=production + +# Configure Memory limit to something higher. +ENV PHP_INI_MEMORY_LIMIT=1g + +# How many GET/POST/COOKIE input variables may be accepted +# See MDL-71390 for more info. This is the recommended / required +# value to support sites having 1000 courses, activities, users.... +ENV PHP_INI_MAX_INPUT_VARS=5000 + +# Increase the maximum filesize to 200M, which is a more realistic figure. +ENV PHP_INI_UPLOAD_MAX_FILESIZE=200M + +# Increase the maximum post size to accomodate the increased upload_max_filesize. +# The default value is 6MB more than the default upload_max_filesize. +ENV PHP_INI_POST_MAX_SIZE=206M + +############################################################################ +# cron configuration +############################################################################ +# The cron daemon used by thecodingmachine images is supercronic. +# https://github.com/thecodingmachine/docker-images-php#supercronic-options + +# By default it does not allow overlappign cron jobs, but Moodle benefits +# from these. +ENV SUPERCRONIC_OPTIONS="=overlapping" + +# Configure the Moodle cron job to run regularly. +# This configuration runs every 15 seconds, but you may need to tailor to +# your requirements. +# example. +# https://github.com/thecodingmachine/docker-images-php#setting-up-cron-jobs +ENV CRON_USER=www-data \ + CRON_SCHEDULE="*/15 * * * *" \ + CRON_COMMAND="php /var/www/html/admin/cli/cron.php" +