From af1a86948b5d9549e31cbabe16c9adf9394e83c7 Mon Sep 17 00:00:00 2001 From: Gustavo Oliveira Date: Sat, 22 Jun 2024 01:00:04 -0300 Subject: [PATCH 1/2] Pipe CI/CD --- .github/workflows/deploy.yml | 43 ++++++++++++++++++++++++++++++++++++ Dockerfile | 13 ++++++----- Dockerfile.dev | 22 ++++++++++++++++++ docker-compose.yml | 2 +- package.json | 2 +- 5 files changed, 74 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile.dev diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..af09b53 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,43 @@ +name: Deploy (Development) + +on: + pull_request: + branches: [ release ] + + workflow_dispatch: + +jobs: + dev: + environment: dev + runs-on: ubuntu-latest + permissions: + id-token: write # This is required for requesting the OIDC JWT Token + contents: read # Required when GH token is used to authenticate with private repo + + steps: + - name: Checkout to the branch + uses: actions/checkout@v2 + + - name: Azure Login + uses: azure/login@v1 + with: + creds: ${{ secrets.AZURE_CREDENTIALS }} + + # TODO: add test step + + - name: Build and Deploy + uses: azure/container-apps-deploy-action@v2 + with: + appSourcePath: ${{ github.workspace }} + dockerfilePath: ./Dockerfile + registryUrl: devplurish.azurecr.io + registryUsername: ${{ secrets.REGISTRY_USERNAME }} + registryPassword: ${{ secrets.REGISTRY_PASSWORD }} + containerAppName: dev-capp-ui-plurish + resourceGroup: dev-rg-plurish + imageToBuild: devplurish.azurecr.io/ui:${{ github.sha }} + targetPort: 8000 + _buildArgumentsKey_: | + _buildArgumentsValues_ + + # TODO: add hml stage \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index e843e60..96a2ed5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ FROM plurish/server:latest +ENV APP_ENV=prod + RUN apt-get install -y --no-install-recommends vim & \ - npm i -g yarn & \ - pecl install xdebug && docker-php-ext-enable xdebug + npm i -g yarn WORKDIR /var/www @@ -13,10 +14,10 @@ RUN chmod 777 /var/www /var/www/yarn.lock /var/www/public USER dev # Installing dependencies -RUN composer install & yarn -RUN composer clear-cache & yarn cache clean +RUN composer install --no-dev --optimize-autoloader & yarn +RUN yarn build # Starting the app -COPY ./xdebug.ini "${PHP_INI_DIR}/conf.d" +EXPOSE 8000 -CMD ["bash", "./init.sh"] \ No newline at end of file +ENTRYPOINT ["symfony", "server:start"] \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000..e843e60 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,22 @@ +FROM plurish/server:latest + +RUN apt-get install -y --no-install-recommends vim & \ + npm i -g yarn & \ + pecl install xdebug && docker-php-ext-enable xdebug + +WORKDIR /var/www + +COPY ./ ./ + +RUN chmod 777 /var/www /var/www/yarn.lock /var/www/public + +USER dev + +# Installing dependencies +RUN composer install & yarn +RUN composer clear-cache & yarn cache clean + +# Starting the app +COPY ./xdebug.ini "${PHP_INI_DIR}/conf.d" + +CMD ["bash", "./init.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 042db8d..b85bc6f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: image: plurish/ui:dev build: context: ./ - dockerfile: Dockerfile + dockerfile: Dockerfile.dev extra_hosts: - host.docker.internal:host-gateway restart: unless-stopped diff --git a/package.json b/package.json index ffccfd6..3ba036d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "devDependencies": { "@babel/core": "^7.17.0", "@babel/preset-env": "^7.16.0", - "@symfony/webpack-encore": "^4.0.0", "autoprefixer": "^10.4.16", "core-js": "^3.23.0", "postcss-loader": "^7.3.3", @@ -33,6 +32,7 @@ "vue": "^3.3.8", "vue-loader": "17.0.0", "vuetify": "^3.4.0", + "@symfony/webpack-encore": "^4.0.0", "webpack-plugin-vuetify": "^2.0.1" } } From ea6f42db354d8427a0a6c66012b8a9da91839ec0 Mon Sep 17 00:00:00 2001 From: Gustavo Oliveira Date: Sat, 30 Nov 2024 20:18:53 -0300 Subject: [PATCH 2/2] Layout fixes + Pipe adjusments --- .github/workflows/deploy.yml | 6 +++--- .vscode/launch.json | 6 +++--- resources/app.html.twig | 4 ++++ resources/views/Auth/SignIn.vue | 4 ++++ resources/views/Auth/SignUp.vue | 4 ++++ 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index af09b53..9ce744e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,12 +30,12 @@ jobs: with: appSourcePath: ${{ github.workspace }} dockerfilePath: ./Dockerfile - registryUrl: devplurish.azurecr.io + registryUrl: plurish.azurecr.io registryUsername: ${{ secrets.REGISTRY_USERNAME }} registryPassword: ${{ secrets.REGISTRY_PASSWORD }} - containerAppName: dev-capp-ui-plurish + containerAppName: dev-capp-plurish-web resourceGroup: dev-rg-plurish - imageToBuild: devplurish.azurecr.io/ui:${{ github.sha }} + imageToBuild: plurish.azurecr.io/ui:${{ github.sha }} targetPort: 8000 _buildArgumentsKey_: | _buildArgumentsValues_ diff --git a/.vscode/launch.json b/.vscode/launch.json index a09028d..4d46056 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -14,13 +14,13 @@ "name": "Start", "request": "launch", "preLaunchTask": "compose-up", - "type": "node" + "type": "node" }, - { + { "name": "Stop", "request": "launch", "preLaunchTask": "compose-down", - "type": "node" + "type": "node" }, ], "compounds": [ diff --git a/resources/app.html.twig b/resources/app.html.twig index d1f779b..fd9b6cd 100644 --- a/resources/app.html.twig +++ b/resources/app.html.twig @@ -13,6 +13,10 @@ + + {{ inertiaHead(page) }} {% block stylesheets %} diff --git a/resources/views/Auth/SignIn.vue b/resources/views/Auth/SignIn.vue index e660e51..01ae42b 100644 --- a/resources/views/Auth/SignIn.vue +++ b/resources/views/Auth/SignIn.vue @@ -120,6 +120,10 @@ export default defineComponent({ }, }), + mounted() { + window.scrollTo(0, 0); + }, + methods: { async signin(event: SubmitEventPromise) { const error = { diff --git a/resources/views/Auth/SignUp.vue b/resources/views/Auth/SignUp.vue index d11cac0..ca86d45 100644 --- a/resources/views/Auth/SignUp.vue +++ b/resources/views/Auth/SignUp.vue @@ -163,6 +163,10 @@ export default defineComponent({ }, }, + mounted() { + window.scrollTo(0, 0); + }, + methods: { async signup(event: SubmitEventPromise) { const error = {