Skip to content

Commit

Permalink
WIP changes to build workflow and run_first script
Browse files Browse the repository at this point in the history
  • Loading branch information
clpetersonucf committed Oct 24, 2024
1 parent 69f00dc commit 524d2a5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 12 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,28 @@ jobs:
touch .env.local
fi
- name: Build App Image
- name: Build App and Webserver Images
run: |
cd docker
docker compose build --no-cache webserver app
- name: Push App Images
- name: Push Dev App and Webserver Images
if: ${{ startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, '-alpha') || contains(github.ref, '-rc')) }}
run: |
docker tag ucfopen/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-dev
docker tag ucfopen/materia:webserver-dev ghcr.io/${{ github.repository_owner }}/materia:webserver-dev
docker push ghcr.io/${{ github.repository_owner }}/materia:app-dev
docker push ghcr.io/${{ github.repository_owner }}/materia:webserver-dev
- name: Push Stable App and Webserver Images
if: ${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-alpha') && !contains(github.ref, '-rc') }}
run: |
docker tag ucfopen/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-stable
docker tag ucfopen/materia:webserver-dev ghcr.io/${{ github.repository_owner }}/materia:webserver-stable
docker push ghcr.io/${{ github.repository_owner }}/materia:app-dev
docker push ghcr.io/${{ github.repository_owner }}/materia:webserver-dev
- name: Push Versioned App and Webserver Images
run: |
docker tag ucfopen/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-${{ github.sha }}
docker tag ucfopen/materia:app-dev ghcr.io/${{ github.repository_owner }}/materia:app-${{ steps.tag_name.outputs.GIT_TAG }}
Expand Down Expand Up @@ -70,7 +86,7 @@ jobs:
overwrite: true

- name: Upload to Pre-Release
if: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-alpha') && contains(github.ref, '-rc') }}
if: ${{ startsWith(github.ref, 'refs/tags/v') && contains(github.ref, '-alpha') || contains(github.ref, '-rc') }}
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
31 changes: 22 additions & 9 deletions docker/run_first.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,27 @@ rm -rf ./config/nginx/cert.pem
# generate a self-signed ssl cert
openssl req -subj '/CN=localhost' -x509 -newkey rsa:4096 -nodes -keyout ./config/nginx/key.pem -out ./config/nginx/cert.pem -days 365

# quietly pull any docker images we can
docker compose pull --ignore-pull-failures
echo "To setup Materia locally, you can choose to pull pre-packaged images or build from source"
echo "1. Pull app and webserver images (recommended if you just want to run Materia locally with no dev)"
echo "2. Build images from source (recommended if you're actively developing Materia)"
read -p "Enter an option (1 or 2): " choice

# install php composer deps
docker compose run --rm --no-deps app composer install --ignore-platform-reqs
if [ "$choice" == "1" ]; then
echo "Pulling containers..."
# quietly pull any docker images we can
docker compose pull


elif [ "$choice" == "2" ]; then
echo "Building containers. This will take a few minutes..."
docker compose build app webserver fakes3

# install php composer deps
docker compose run --rm --no-deps app composer install --ignore-platform-reqs
else
echo "Invalid choice. Try again."
exit 1
fi

# run migrations and seed any db data needed for a new install
docker compose run --rm app /wait-for-it.sh mysql:3306 --timeout=120 --strict -- composer oil-install-quiet
Expand All @@ -38,12 +54,9 @@ docker compose run --rm app bash -c 'php oil r widget:install_from_config'
# Install any widgets in the tmp dir
source run_widgets_install.sh '*.wigt'

# build all the js/css assets
source run_build_assets.sh

# create a dev user based on your current shell user (password will be 'kogneato') MATERIA_DEV_PASS=whatever can be used to set a custom pw
source run_create_me.sh

echo -e "Materia will be hosted on \033[32m$DOCKER_IP\033[0m"
echo -e "\033[1mRun an oil comand:\033[0m ./run.sh php oil r widget:show_engines"
echo -e "\033[1mRun the web app:\033[0m docker compose up"
echo -e '\033[1mRun an oil comand:\033[0m ./run.sh php oil r widget:show_engines'
echo -e '\033[1mRun the web app:\033[0m docker compose up'

0 comments on commit 524d2a5

Please sign in to comment.