From 2650730411382b7c53d49b9e2433843d50e1d6de Mon Sep 17 00:00:00 2001 From: Konkamon Sion Date: Sun, 13 Oct 2024 00:13:33 +0700 Subject: [PATCH] chore(Azure): :rocket: Using Azure's Container App to Deploy --- ...ic-web-apps-delightful-smoke-0b894a600.yml | 46 ------------------- Dockerfile | 29 ++++++++++++ 2 files changed, 29 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/azure-static-web-apps-delightful-smoke-0b894a600.yml create mode 100644 Dockerfile diff --git a/.github/workflows/azure-static-web-apps-delightful-smoke-0b894a600.yml b/.github/workflows/azure-static-web-apps-delightful-smoke-0b894a600.yml deleted file mode 100644 index f4449c9..0000000 --- a/.github/workflows/azure-static-web-apps-delightful-smoke-0b894a600.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: '[konkamon-nuxt] Azure Static Web Apps CI/CD' - -on: - push: - branches: - - main - - dev - pull_request: - types: [opened, synchronize, reopened, closed] - branches: - - main - -jobs: - build_and_deploy_job: - if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') - runs-on: ubuntu-latest - name: Build and Deploy Job - environment: Production - steps: - - uses: actions/checkout@v4 - with: - submodules: true - lfs: false - - - name: Set up Node.js version - uses: actions/setup-node@v4 - with: - node-version: '20.17.0' - - - name: Build And Deploy - id: builddeploy - uses: Azure/static-web-apps-deploy@v1 - - with: - production_branch: 'main' - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_DELIGHTFUL_SMOKE_0B894A600 }} - repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) - action: 'upload' - ###### Repository/Build Configurations - These values can be configured to match your app requirements. ###### - # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig - app_location: '/' # App source code path - api_location: '.output/server' # Api source code path - optional - output_location: '.output/public' # Built app content directory - optional - ###### End of Repository/Build Configurations ###### - env: - STRAPI_URL: ${{ vars.STRAPI_URL }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dac2bc9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +ARG NODE_VERSION=20.18.0 + +FROM node:${NODE_VERSION}-slim AS build + +RUN corepack prepare yarn@stable --activate + +WORKDIR /app + +COPY ./package.json /app/ + +COPY ./yarn.lock /app/ + +RUN yarn install + +COPY . ./ + +RUN yarn build + +FROM node:${NODE_VERSION}-slim + +WORKDIR /app + +COPY --from=build /app/.output ./ + +ENV HOST=0.0.0.0 NODE_ENV=production + +EXPOSE 3000 + +CMD ["node","/app/server/index.mjs"] \ No newline at end of file