From ec446977fc776954d73847385539ceb84232981d Mon Sep 17 00:00:00 2001 From: Varun Khatri Date: Sun, 11 May 2025 15:36:28 +0530 Subject: [PATCH 1/3] feat(docker): Caddyfile implementation for YASM Frontend --- Caddyfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Caddyfile diff --git a/Caddyfile b/Caddyfile new file mode 100644 index 0000000..adbb99b --- /dev/null +++ b/Caddyfile @@ -0,0 +1,30 @@ +{ + # global options + admin off + persist_config off + auto_https off + # runtime logs + log { + format json + } +} + +# site block, listens on the $PORT environment variable +:{$PORT:3000} { + # access logs + log { + format json # set access log format to json mode + } + + # serve from the 'dist' folder (Vite builds into the 'dist' folder) + root * dist + + # enable gzipping responses + encode gzip + + # serve files from 'dist' + file_server + + # if path doesn't exist, redirect it to 'index.html' for client side routing + try_files {path} /index.html +} From d3126e15d047c8ce6df98a0efbefab76f5638de9 Mon Sep 17 00:00:00 2001 From: Varun Khatri Date: Sun, 11 May 2025 15:36:42 +0530 Subject: [PATCH 2/3] feat(docker): Dockerfile implementation for YASM Frontend --- .dockerignore | 24 ++++++++++++++++++++++++ Dockerfile | 27 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c1a985 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Build stage +FROM denoland/deno:latest as builder + +WORKDIR /app +COPY . . + +# Build the Solid App +RUN deno install && \ + deno task build + +# Production stage +FROM caddy + +WORKDIR /app + +# Copy the Caddyfile and format it +COPY Caddyfile ./ +RUN caddy fmt Caddyfile --overwrite + +# Copy the built static website +COPY --from=builder /app/dist ./dist + +# Port to be used for exposing the site +ENV PORT=5173 +EXPOSE 5173 + +CMD ["caddy", "run", "--config", "Caddyfile", "--adapter", "caddyfile"] From 0402f3d8e300255754cdb822c36c0365b5a6a585 Mon Sep 17 00:00:00 2001 From: Varun Khatri Date: Sun, 11 May 2025 15:37:23 +0530 Subject: [PATCH 3/3] ci(build): docker image build pipeline for YASM Frontend --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2221eb5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,29 @@ +name: Build and store YASM Frontend Image + +on: + push: + branches: + - task/** + - feature/** + - bug/** + pull_request: + branches: + - main + types: + - opened + - synchronize + - closed + +jobs: + build_push_image: + name: Building and storing YASM Frontend Docker Image + uses: necro-cloud/automations/.github/workflows/build-docker-image.yml@main + with: + dev_version_name: development + image_name: frontend + image_proper_name: YASM Frontend + build_path: . + repository: yasm + secrets: + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}