diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 273bdff7..652449ab 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -10,7 +10,6 @@ concurrency: env: PROJECT: ${{ secrets.PROJECT }} - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets._GITHUB_AUTH_TOKEN }}"}}' jobs: build_service: @@ -49,7 +48,9 @@ jobs: - name: Prepare Composer Auth Secret run: | if [[ -n "${{ secrets._GITHUB_AUTH_TOKEN }}" ]]; then - echo '${{ env.COMPOSER_AUTH }}' > composer-auth.json + echo '{"github-oauth": {"github.com": "'${{ secrets._GITHUB_AUTH_TOKEN }}'"}}' > composer-auth.json + else + echo '{}' > composer-auth.json fi - name: Build and Release diff --git a/docker/Dockerfile b/docker/Dockerfile index 44f6a26a..cca90744 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -36,6 +36,7 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Set some build ENV variables ENV LOG_CHANNEL=stdout +ENV CACHE_DRIVER=null # For development only WORKDIR /var/www/html @@ -46,6 +47,12 @@ WORKDIR /var/www/html/api COPY --chown=www-data:nogroup ./api ./ RUN chown -R www-data:www-data /var/www/html/api +# Setup composer root directory +RUN mkdir -p /root/.composer + +# Load the secret into the auth.json file. +RUN --mount=type=secret,id=composer_auth,dst=/root/.composer/auth.json + # Setup logging # RUN mkdir -p ./storage/logs/ && ln -sf /dev/stdout ./storage/logs/laravel-$(date +'%Y-%m-%d').log RUN mkdir -p ./storage/logs/ && touch ./storage/logs/laravel-$(date +'%Y-%m-%d').log @@ -64,12 +71,6 @@ WORKDIR / # Create unique instance ID RUN echo $(cat /proc/sys/kernel/random/uuid) > /.fleetbase -# Setup composer root directory -RUN mkdir -p /root/.composer - -# Load the secret into the auth.json file. -RUN --mount=type=secret,id=composer_auth,dst=/root/.composer/auth.json - # Set environment ARG ENVIRONMENT=production ENV APP_ENV=$ENVIRONMENT