From 0ef4f3f3233fbd8eb9064de379785f65e5f272a2 Mon Sep 17 00:00:00 2001 From: "lens-local-glenn[bot]" <174390184+lens-local-glenn[bot]@users.noreply.github.com> Date: Wed, 25 Sep 2024 04:35:37 +0000 Subject: [PATCH] adding project initilization workflow --- .github/workflows/init-project.yml | 38 +++++++++++++++++++++++++++--- Dockerfile | 5 ++-- next.config.mjs | 5 ++-- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/.github/workflows/init-project.yml b/.github/workflows/init-project.yml index 4eecc5e..eda8ae7 100644 --- a/.github/workflows/init-project.yml +++ b/.github/workflows/init-project.yml @@ -5,7 +5,7 @@ on: workflow_dispatch: env: - IMAGE_PREFIX: registry.cloudzilla.ai/lens-project-71fcfdc4/ + IMAGE_PREFIX: registry.cloudzilla.ai/lens-local-glenn-project-0d5e4480/ jobs: build-push: @@ -22,7 +22,7 @@ jobs: uses: docker/login-action@v3 with: registry: https://registry.cloudzilla.ai/ - username: 'robot$lens-project-71fcfdc4+imageuser' + username: 'robot$lens-local-glenn-project-0d5e4480+imageuser' password: '${{ secrets.DOCKER_PASSWORD }}' - name: downcase REPO @@ -36,6 +36,38 @@ jobs: with: images: ${{ env.IMAGE_PREFIX }}${{ env.IMAGE_NAME }} + - name: Valiate existing .env file + run: | + # Path to your .env file + ENV_FILE=".env" + # Check if the .env file exists + if [ ! -f "$ENV_FILE" ]; then + # If the .env file doesn't exist, exit the script + exit 0 + fi + + # Read the .env file line by line + while IFS= read -r line || [ -n "$line" ]; do + # Remove leading and trailing whitespace + line="$(echo "$line" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + + # Skip empty lines + if [ -z "$line" ]; then + continue + fi + + # Skip comment lines starting with # + if [[ "$line" == \#* ]]; then + continue + fi + + # Check if the line matches KEY=VALUE format + if ! [[ "$line" =~ ^[A-Za-z_][A-Za-z0-9_]*=.*$ ]]; then + echo "Your existing .env file is not valid. Environment variable names (keys) must consist solely of letters, digits, and the underscore ( _ ) and must not begin with a digit according to the .env file specification" + exit 1 + fi + done < "$ENV_FILE" + - name: Put down .env file run: | echo "writing .env file..." @@ -56,7 +88,7 @@ jobs: SECTION_K8S_API_URL: '${{ secrets.SECTION_K8S_API_URL }}' SECTION_API_TOKEN: '${{ secrets.SECTION_API_TOKEN }}' DOCKER_SERVER: 'registry.cloudzilla.ai' - DOCKER_USERNAME: 'robot$lens-project-71fcfdc4+imageuser' + DOCKER_USERNAME: 'robot$lens-local-glenn-project-0d5e4480+imageuser' DOCKER_PASSWORD: '${{ secrets.DOCKER_PASSWORD }}' FULL_IMAGE_WITH_TAG: '${{ env.DOCKER_METADATA_OUTPUT_TAGS }}' POD_NAME: '${{ env.IMAGE_NAME }}' diff --git a/Dockerfile b/Dockerfile index 0f52a0e..11f8acc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,10 +8,11 @@ ENV PATH /app/node_modules/.bin:$PATH # install app dependencies COPY package.json yarn.lock* package-lock.json* ./ -RUN yarn +RUN yarn install # add app to container and attempt build COPY . ./ RUN yarn build || true -CMD ["yarn", "start"] +# the start command needs to be triple curly braces to avoid escaping special characters +CMD ["yarn", "start"] \ No newline at end of file diff --git a/next.config.mjs b/next.config.mjs index 4678774..2937c03 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,5 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; - +const nextConfig = { + output: 'standalone', +}; export default nextConfig;