diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ccb7b8c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,73 @@ +name: Build eBot-CSGO-Web + +on: + push: + branches: [ master, main, develop ] + pull_request: + branches: [ master, main, develop ] + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup PHP 5.6 + uses: shivammathur/setup-php@v2 + with: + php-version: '5.6' + extensions: mysqli, pdo_mysql + + - name: Check PHP syntax + run: find apps lib -name "*.php" -not -path "lib/vendor/*" -print0 | xargs -0 -n1 php -l + + - name: Verify key files exist + run: | + test -f symfony + test -f config/databases.yml + test -f config/app.yml + echo "All key files present" + + docker-build: + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'push' + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + tags: | + type=ref,event=branch + type=sha,prefix={{branch}}- + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ddbb69b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM php:5.6-fpm + +# Use archived Debian Stretch repos (required for PHP 5.6 era dependencies) +RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list + +RUN apt-get update && apt-get install -y --force-yes \ + git \ + default-mysql-client \ + && rm -rf /var/lib/apt/lists/* + +# Install PHP extensions +RUN docker-php-ext-install mysqli pdo pdo_mysql && docker-php-ext-enable pdo_mysql + +# Set timezone +RUN echo "date.timezone = Europe/Paris" >> /usr/local/etc/php/conf.d/timezone.ini + +WORKDIR /app + +# Bake source into /app/source at build time — entrypoint copies to volume target at runtime +COPY . /app/source/ + +COPY docker-entrypoint.sh /app/docker-entrypoint.sh +RUN sed -i 's/\r$//' /app/docker-entrypoint.sh && chmod +x /app/docker-entrypoint.sh + +CMD ["/app/docker-entrypoint.sh"] diff --git a/apps/backend/templates/layout_external.php b/apps/backend/templates/layout_external.php index 1271b00..d596dc2 100644 --- a/apps/backend/templates/layout_external.php +++ b/apps/backend/templates/layout_external.php @@ -4,6 +4,7 @@