Skip to content

Commit

Permalink
adding project initilization workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
1 parent 872dd83 commit 0ef4f3f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
38 changes: 35 additions & 3 deletions .github/workflows/init-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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..."
Expand All @@ -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 }}'
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
5 changes: 3 additions & 2 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};

const nextConfig = {
output: 'standalone',
};
export default nextConfig;

0 comments on commit 0ef4f3f

Please sign in to comment.