From ba316208a8c4128adc82e8d6c7f0e272f7345182 Mon Sep 17 00:00:00 2001 From: Mehdi Date: Thu, 27 Jul 2023 17:28:31 +0330 Subject: [PATCH] ad github workflow --- .github/workflows/docker.yml | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..f02d60c --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,59 @@ +name: Build and Push Docker Images + +on: + push: + branches: + - main + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Build and Push Docker images + run: | + DIR=$GITHUB_WORKSPACE + SERVICE_DIR="${DIR}/services" + DOCKER_BUILDKIT=1 + + docker buildx build -f "$DIR/Dockerfile" "$DIR" -t daalvand/speed-test-base:latest + docker buildx build -f "$SERVICE_DIR/pure-php/Dockerfile" "$SERVICE_DIR/pure-php" -t daalvand/speed-test-pure-php:latest + docker buildx build -f "$SERVICE_DIR/react-php/Dockerfile" "$SERVICE_DIR/react-php" -t daalvand/speed-test-react-php:latest + docker buildx build -f "$SERVICE_DIR/swoole-php/Dockerfile" "$SERVICE_DIR/swoole-php" -t daalvand/speed-test-swoole-php:latest + docker buildx build -f "$SERVICE_DIR/yii/Dockerfile" "$SERVICE_DIR/yii" -t daalvand/speed-test-yii:latest + docker buildx build -f "$SERVICE_DIR/codeigniter/Dockerfile" "$SERVICE_DIR/codeigniter" -t daalvand/speed-test-codeigniter:latest + docker buildx build -f "$SERVICE_DIR/laravel/FPMDockerfile" "$SERVICE_DIR/laravel" -t daalvand/speed-test-laravel:latest + docker buildx build -f "$SERVICE_DIR/laravel/SwooleDockerfile" "$SERVICE_DIR/laravel" -t daalvand/speed-test-laravel-octane:latest + docker buildx build -f "$SERVICE_DIR/go/Dockerfile" "$SERVICE_DIR/go" -t daalvand/speed-test-go:latest + docker buildx build -f "$SERVICE_DIR/fastapi/Dockerfile" "$SERVICE_DIR/fastapi" -t daalvand/speed-test-fastapi:latest + docker buildx build -f "$SERVICE_DIR/flask/Dockerfile" "$SERVICE_DIR/flask" -t daalvand/speed-test-flask:latest + docker buildx build -f "$SERVICE_DIR/nodejs/Dockerfile" "$SERVICE_DIR/nodejs" -t daalvand/speed-test-nodejs:latest + + echo 'DONE!' + + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker images + run: | + docker push daalvand/speed-test-base:latest + docker push daalvand/speed-test-pure-php:latest + docker push daalvand/speed-test-react-php:latest + docker push daalvand/speed-test-swoole-php:latest + docker push daalvand/speed-test-yii:latest + docker push daalvand/speed-test-codeigniter:latest + docker push daalvand/speed-test-laravel:latest + docker push daalvand/speed-test-laravel-octane:latest + docker push daalvand/speed-test-go:latest + docker push daalvand/speed-test-fastapi:latest + docker push daalvand/speed-test-flask:latest + docker push daalvand/speed-test-nodejs:latest