diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml index 5c0847f01..e7c4fb36b 100644 --- a/.github/workflows/test_and_build.yml +++ b/.github/workflows/test_and_build.yml @@ -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 }} @@ -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 }} diff --git a/docker/run_first.sh b/docker/run_first.sh index 9e2ec6a2a..9b31ba945 100755 --- a/docker/run_first.sh +++ b/docker/run_first.sh @@ -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 @@ -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'