diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..07d7f96 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,49 @@ +name: Deploy build + +on: + push: + branches: [ master ] + + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-20.04 + steps: + - + name: Checkout + uses: actions/checkout@v4 + + - name: Install dependencies + uses: php-actions/composer@v6 + with: + php_version: "7.4" + version: 2 + + - name: Build + run: | + php7.4 vendor/bin/sculpin generate -vvv -n --env=prod > build_output.log + if grep -iq "notice\|error\|warning" build_output.log ; then return 1; fi + + - name: Output + run: cat build_output.log + + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: phperspl/phpers-website:latest \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/test.yml similarity index 87% rename from .github/workflows/main.yml rename to .github/workflows/test.yml index eead9b1..5a375d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/test.yml @@ -1,15 +1,13 @@ name: Test build on: - push: - branches: [ master ] pull_request: branches: [ master ] workflow_dispatch: jobs: - build: + test: runs-on: ubuntu-20.04 steps: @@ -27,4 +25,4 @@ jobs: if grep -iq "notice\|error\|warning" build_output.log ; then return 1; fi - name: Output - run: cat build_output.log + run: cat build_output.log \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e901a7c..1d4c73d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,4 @@ -FROM php:7.4-alpine +FROM nginx:latest -RUN apk add --no-cache git curl -RUN curl -o /usr/bin/composer https://getcomposer.org/download/2.2.6/composer.phar -RUN chmod 755 /usr/bin/composer - -VOLUME /app -WORKDIR /app -EXPOSE 8000 - -CMD ["/usr/bin/composer"] \ No newline at end of file +RUN rm -r /usr/share/nginx/html +COPY output_prod /usr/share/nginx/html