From 8de1e42786ca4ebbd8c175b8131bd221aa495ed5 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Wed, 18 Jun 2025 14:24:09 -0400 Subject: [PATCH 01/14] Improved Dockerfiles for dev and prd --- Dockerfile.dev | 19 +++++++++++++++---- Dockerfile.prod | 19 +++++++------------ 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index c2d6384f..e3fae3ba 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -1,15 +1,26 @@ -# Use the official node image as a parent image +# Use the official Node.js 18 image FROM node:18 # Set the working directory WORKDIR /app -# Copy package files first to leverage Docker cache +# Environment setup to avoid esbuild platform bloat +ENV npm_config_platform=linux +ENV npm_config_arch=x64 +ENV ESBUILD_BINARY_PATH=node_modules/esbuild/bin/esbuild +ENV NODE_ENV=development + +# Copy package files early to leverage Docker cache COPY package.json yarn.lock ./ -RUN yarn install -# Then copy the rest of the files +# Install dependencies with verbosity and concurrency limits +RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress --verbose + +# Copy the full app source COPY . . +# Expose dev server port EXPOSE 8080 + +# Start in dev mode CMD ["yarn", "dev"] diff --git a/Dockerfile.prod b/Dockerfile.prod index a86de9aa..8ea59985 100644 --- a/Dockerfile.prod +++ b/Dockerfile.prod @@ -4,28 +4,23 @@ FROM node:18 # Set working directory WORKDIR /app -# Define build-time environment to limit esbuild platform downloads +# Environment variables to avoid platform-specific esbuild bloat ENV npm_config_platform=linux ENV npm_config_arch=x64 ENV ESBUILD_BINARY_PATH=node_modules/esbuild/bin/esbuild +ENV NODE_ENV=production -# Copy dependency definitions early to leverage Docker cache +# Copy dependency definitions first to leverage Docker cache COPY package.json yarn.lock ./ -# Install ping for connectivity check (optional for debugging only) -RUN apt-get update && apt-get install -y iputils-ping - -# Run basic connectivity test (can be removed later) -RUN ping -c 2 registry.yarnpkg.com - -# Install dependencies with caching and better error handling +# Install dependencies with robustness and speed RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress --verbose -# Copy application source +# Copy app source COPY . . -# Expose your app port +# Expose app port EXPOSE 8080 -# Default command +# Run app CMD ["yarn", "start"] From 037512a3b9f50d9dcc37f790ad10d18b8473af1b Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Wed, 18 Jun 2025 20:54:36 -0400 Subject: [PATCH 02/14] fixed deploy workflows --- .cursorignore | 5 ++--- .github/workflows/deploy.dev.yaml | 1 - .github/workflows/deploy.prod.yaml | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.cursorignore b/.cursorignore index 79d16e57..6bcc42d9 100644 --- a/.cursorignore +++ b/.cursorignore @@ -1,5 +1,3 @@ -!.github/workflows/ - # Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv) # Ignore all files in the node_modules directory @@ -61,7 +59,8 @@ deployments/ ocf/build/ # GitHub workflows -.github/ +!.github/workflows/ +!.github/workflows/*.yml # Generated files *.gen.ts diff --git a/.github/workflows/deploy.dev.yaml b/.github/workflows/deploy.dev.yaml index e492cffa..8eede012 100644 --- a/.github/workflows/deploy.dev.yaml +++ b/.github/workflows/deploy.dev.yaml @@ -106,7 +106,6 @@ jobs: --health-interval='2s' \ --health-retries='3' \ --health-timeout='5s' \ - --restart always \ -e DOCKER_ENV='true' \ -e NODE_ENV='development' \ -e SENTRY_DSN='${SENTRY_DSN}' \ diff --git a/.github/workflows/deploy.prod.yaml b/.github/workflows/deploy.prod.yaml index 022c084c..ffdf1575 100644 --- a/.github/workflows/deploy.prod.yaml +++ b/.github/workflows/deploy.prod.yaml @@ -106,7 +106,6 @@ jobs: --health-interval='2s' \ --health-retries='3' \ --health-timeout='5s' \ - --restart always \ -e DOCKER_ENV='true' \ -e NODE_ENV='production' \ -e SENTRY_DSN='${SENTRY_DSN}' \ From fd24b91ce7a2e11d225be1a34b3d3bdd7566f368 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Wed, 18 Jun 2025 21:29:10 -0400 Subject: [PATCH 03/14] fixed deploy workflows (bis) --- .github/workflows/deploy.dev.yaml | 2 +- .github/workflows/deploy.prod.yaml | 2 +- Dockerfile.dev | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.dev.yaml b/.github/workflows/deploy.dev.yaml index 8eede012..290fcc1f 100644 --- a/.github/workflows/deploy.dev.yaml +++ b/.github/workflows/deploy.dev.yaml @@ -33,7 +33,7 @@ jobs: ${{ runner.os }}-yarn- - name: Install Node Dependencies - run: yarn install --frozen-lockfile --network-concurrency 5 --no-progress --verbose + run: yarn install --frozen-lockfile --network-concurrency 5 --no-progress - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 diff --git a/.github/workflows/deploy.prod.yaml b/.github/workflows/deploy.prod.yaml index ffdf1575..9f82badb 100644 --- a/.github/workflows/deploy.prod.yaml +++ b/.github/workflows/deploy.prod.yaml @@ -33,7 +33,7 @@ jobs: ${{ runner.os }}-yarn- - name: Install Node Dependencies - run: yarn install --frozen-lockfile --network-concurrency 5 --no-progress --verbose + run: yarn install --frozen-lockfile --network-concurrency 5 --no-progress - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 diff --git a/Dockerfile.dev b/Dockerfile.dev index e3fae3ba..83c63f49 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -22,5 +22,5 @@ COPY . . # Expose dev server port EXPOSE 8080 -# Start in dev mode -CMD ["yarn", "dev"] +# Start in dev mode, but run the app directly without a file watcher +CMD ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev npx tsx src/app.js"] From 1ae90c7892c9ed59c65a36f7863d3bb44418a686 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Wed, 18 Jun 2025 21:50:06 -0400 Subject: [PATCH 04/14] fixed deploy workflows (ter) --- Dockerfile.dev | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 83c63f49..c10468dc 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -22,5 +22,5 @@ COPY . . # Expose dev server port EXPOSE 8080 -# Start in dev mode, but run the app directly without a file watcher -CMD ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev npx tsx src/app.js"] +# Start in dev mode, overriding the default entrypoint to prevent file watching +ENTRYPOINT ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev npx tsx src/app.js"] From 6bbbc392d1ecd0b395da46226d7bce7f38b7436a Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 00:32:40 -0400 Subject: [PATCH 05/14] remove verbose for yarn install --- Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index c10468dc..54292367 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -14,7 +14,7 @@ ENV NODE_ENV=development COPY package.json yarn.lock ./ # Install dependencies with verbosity and concurrency limits -RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress --verbose +RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress # Copy the full app source COPY . . From 02200ad0dbcad65141d16c3b672fe63f4ca3b83a Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 00:58:07 -0400 Subject: [PATCH 06/14] fix Dockerfile dev --- Dockerfile.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 54292367..db2b3664 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -23,4 +23,4 @@ COPY . . EXPOSE 8080 # Start in dev mode, overriding the default entrypoint to prevent file watching -ENTRYPOINT ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev npx tsx src/app.js"] +ENTRYPOINT ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev npx tsx --no-cache src/app.js"] From e6887784fdc7856fed588765fc2cd05c01140102 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 10:29:16 -0400 Subject: [PATCH 07/14] new deployment strategy --- Dockerfile.dev | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index db2b3664..c4415a3e 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -19,8 +19,11 @@ RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress # Copy the full app source COPY . . +# Build the application +RUN npx tsx --build src/app.js --outfile dist/app.js + # Expose dev server port EXPOSE 8080 -# Start in dev mode, overriding the default entrypoint to prevent file watching -ENTRYPOINT ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev npx tsx --no-cache src/app.js"] +# Start in dev mode, running the built file with node +ENTRYPOINT ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev node dist/app.js"] From eb71fd4b5ccfe94f4769315541da9477dbb792d3 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 10:52:41 -0400 Subject: [PATCH 08/14] Fix new deployment strategy --- Dockerfile.dev | 2 +- package.json | 1 + yarn.lock | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index c4415a3e..e78152eb 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -20,7 +20,7 @@ RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress COPY . . # Build the application -RUN npx tsx --build src/app.js --outfile dist/app.js +RUN npx esbuild src/app.js --bundle --platform=node --format=esm --outfile=dist/app.js # Expose dev server port EXPOSE 8080 diff --git a/package.json b/package.json index 349f3c38..1a92ad4c 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "@typescript-eslint/eslint-plugin": "^6.19.0", "@typescript-eslint/parser": "^6.19.0", "chalk": "4", + "esbuild": "^0.23.0", "eslint": "^8.56.0", "eslint-config-prettier": "^9.1.0", "eslint-import-resolver-node": "^0.3.9", diff --git a/yarn.lock b/yarn.lock index 4ce458d0..18ff4fc9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3322,7 +3322,7 @@ es6-promisify@^5.0.0: dependencies: es6-promise "^4.0.3" -esbuild@~0.23.0: +esbuild@^0.23.0, esbuild@~0.23.0: version "0.23.1" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.23.1.tgz#40fdc3f9265ec0beae6f59824ade1bd3d3d2dab8" integrity sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg== From 5ea2c5132be9dffaeb40e30bba5eac28d4e907d8 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 11:10:54 -0400 Subject: [PATCH 09/14] Use github runner to build the app instead of building it on the lightsail instance --- .github/workflows/deploy.dev.yaml | 5 ++++- .github/workflows/deploy.prod.yaml | 5 ++++- Dockerfile.prod => Dockerfile | 12 ++++++------ Dockerfile.dev | 29 ----------------------------- 4 files changed, 14 insertions(+), 37 deletions(-) rename Dockerfile.prod => Dockerfile (70%) delete mode 100644 Dockerfile.dev diff --git a/.github/workflows/deploy.dev.yaml b/.github/workflows/deploy.dev.yaml index 290fcc1f..5f304144 100644 --- a/.github/workflows/deploy.dev.yaml +++ b/.github/workflows/deploy.dev.yaml @@ -52,6 +52,9 @@ jobs: - name: Check Formatting run: yarn format:check + - name: Build Application + run: npx esbuild src/app.js --bundle --platform=node --format=esm --outfile=dist/app.js + - name: Deploy shell: bash env: @@ -91,7 +94,7 @@ jobs: cd /home/ubuntu/app-${DEPLOY_TIME} && \ echo 'Building image on host...' && \ source ./scripts/docker_container_utils.sh && \ - docker build -t ocp-dev:${DEPLOY_TIME} -f Dockerfile.dev . && \ + docker build -t ocp-dev:${DEPLOY_TIME} -f Dockerfile . && \ echo 'Cleaning up old resources...' && \ docker ps -q --filter 'publish=8081' | xargs -r docker rm -f && \ diff --git a/.github/workflows/deploy.prod.yaml b/.github/workflows/deploy.prod.yaml index 9f82badb..7200cb12 100644 --- a/.github/workflows/deploy.prod.yaml +++ b/.github/workflows/deploy.prod.yaml @@ -52,6 +52,9 @@ jobs: - name: Check Formatting run: yarn format:check + - name: Build Application + run: npx esbuild src/app.js --bundle --platform=node --format=esm --outfile=dist/app.js + - name: Deploy shell: bash env: @@ -91,7 +94,7 @@ jobs: cd /home/ubuntu/app-${DEPLOY_TIME} && \ echo 'Building image on host...' && \ source ./scripts/docker_container_utils.sh && \ - docker build -t ocp-prod:${DEPLOY_TIME} -f Dockerfile.prod . && \ + docker build -t ocp-prod:${DEPLOY_TIME} -f Dockerfile . && \ echo 'Cleaning up old resources...' && \ docker ps -q --filter 'publish=8081' | xargs -r docker rm -f && \ diff --git a/Dockerfile.prod b/Dockerfile similarity index 70% rename from Dockerfile.prod rename to Dockerfile index 8ea59985..924b3988 100644 --- a/Dockerfile.prod +++ b/Dockerfile @@ -7,20 +7,20 @@ WORKDIR /app # Environment variables to avoid platform-specific esbuild bloat ENV npm_config_platform=linux ENV npm_config_arch=x64 -ENV ESBUILD_BINARY_PATH=node_modules/esbuild/bin/esbuild ENV NODE_ENV=production # Copy dependency definitions first to leverage Docker cache COPY package.json yarn.lock ./ -# Install dependencies with robustness and speed -RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress --verbose +# Install dependencies +# Using --frozen-lockfile is best practice for CI/CD +RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress -# Copy app source +# Copy app source and pre-built files COPY . . # Expose app port EXPOSE 8080 -# Run app -CMD ["yarn", "start"] +# Run the pre-built application +CMD ["node", "dist/app.js"] diff --git a/Dockerfile.dev b/Dockerfile.dev deleted file mode 100644 index e78152eb..00000000 --- a/Dockerfile.dev +++ /dev/null @@ -1,29 +0,0 @@ -# Use the official Node.js 18 image -FROM node:18 - -# Set the working directory -WORKDIR /app - -# Environment setup to avoid esbuild platform bloat -ENV npm_config_platform=linux -ENV npm_config_arch=x64 -ENV ESBUILD_BINARY_PATH=node_modules/esbuild/bin/esbuild -ENV NODE_ENV=development - -# Copy package files early to leverage Docker cache -COPY package.json yarn.lock ./ - -# Install dependencies with verbosity and concurrency limits -RUN yarn install --frozen-lockfile --network-concurrency 5 --no-progress - -# Copy the full app source -COPY . . - -# Build the application -RUN npx esbuild src/app.js --bundle --platform=node --format=esm --outfile=dist/app.js - -# Expose dev server port -EXPOSE 8080 - -# Start in dev mode, running the built file with node -ENTRYPOINT ["sh", "-c", "NODE_ENV=development USE_ENV_FILE=.env.dev node dist/app.js"] From b7255ed846b7364be9c114b562b206d89232e967 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 11:24:22 -0400 Subject: [PATCH 10/14] Added health endpoint --- src/app.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app.js b/src/app.js index efda438f..91831dd0 100644 --- a/src/app.js +++ b/src/app.js @@ -103,6 +103,11 @@ app.use("/manifest", manifestRoutes); // transactions app.use("/transactions/", contractMiddleware, transactionRoutes); +// Health check endpoint +app.get("/health", (req, res) => { + res.status(200).send("OK"); +}); + const startServer = async () => { // Connect to MongoDB await connectDB(); From 9e3112b6fa06b9fa140d83c8fbdc77c774041a07 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 11:31:18 -0400 Subject: [PATCH 11/14] Added docker logs --- scripts/docker_container_utils.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/docker_container_utils.sh b/scripts/docker_container_utils.sh index 404794d3..cfcccc67 100644 --- a/scripts/docker_container_utils.sh +++ b/scripts/docker_container_utils.sh @@ -14,18 +14,18 @@ wait_for_health() { local timeout_duration=30 local start_time=$(date +%s) local end_time=$((start_time + timeout_duration)) - + echo "Waiting for container to be healthy..." while (( $(date +%s) < end_time )); do local status=$(check_health "$container_name") echo "Container health status: [$status]" - + if [[ "$status" = "healthy" ]]; then return 0 fi sleep 2 done - + return 1 } @@ -39,7 +39,7 @@ handle_container_switch() { # Get current container config local config=$(docker inspect "$container_name" --format='{{range .Config.Env}} -e {{.}}{{end}}') local image=$(docker inspect "$container_name" --format='{{.Config.Image}}') - + # Create new container but don't start it yet echo "Creating final container..." docker create \ @@ -53,7 +53,7 @@ handle_container_switch() { $config \ -v '/home/ubuntu/global-bundle.pem:/global-bundle.pem' \ $image - + # Atomic switch: stop old container and start new one as quickly as possible echo "Performing atomic switch..." ( @@ -63,21 +63,21 @@ handle_container_switch() { docker rename ocp-${environment}-final ocp-${environment} docker start ocp-${environment} ) & # Run in background - + # Wait for background process wait $! - + # Verify new container is running if ! docker ps --filter "name=ocp-${environment}" --filter "status=running" | grep -q ocp-${environment}; then echo "Switch failed, rolling back..." return 1 fi - + # Stop and remove the old container docker stop "$container_name" docker rm "$container_name" - + echo 'Performing final cleanup...' # Force remove old images docker image ls "ocp-${environment}:*" --format '{{.ID}}' | tail -n +3 | xargs -r docker image rm -f @@ -85,7 +85,7 @@ handle_container_switch() { docker system prune -af --volumes # Tag the current image as latest docker tag "ocp-${environment}:${deploy_time}" ocp-${environment}:latest - + echo 'Deployment successful!' cd /home/ubuntu && rm -rf "app-${deploy_time}" return 0 @@ -97,9 +97,11 @@ handle_failed_deployment() { local deploy_time="$2" local environment="$3" echo 'New container failed health check, rolling back...' + echo "Dumping logs for container: $container_name" + docker logs "$container_name" docker stop "$container_name" docker rm "$container_name" docker image rm "ocp-${environment}:${deploy_time}" cd /home/ubuntu && rm -rf "app-${deploy_time}" return 1 -} \ No newline at end of file +} From c3da491ed44f52838d1e0699220dacfe9e037b2f Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 11:39:26 -0400 Subject: [PATCH 12/14] Added docker logs (fixed bug) --- .github/workflows/deploy.dev.yaml | 2 +- .github/workflows/deploy.prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.dev.yaml b/.github/workflows/deploy.dev.yaml index 5f304144..552e8fb2 100644 --- a/.github/workflows/deploy.dev.yaml +++ b/.github/workflows/deploy.dev.yaml @@ -120,7 +120,7 @@ jobs: -v '/home/ubuntu/global-bundle.pem:/global-bundle.pem' \ ocp-dev:${DEPLOY_TIME} && \ - wait_for_health \"\$CONTAINER_NAME\" && \ + wait_for_health \"\$CONTAINER_NAME\" if [ \$? -eq 0 ]; then handle_container_switch \"\$CONTAINER_NAME\" \"${DEPLOY_TIME}\" \"dev\" else diff --git a/.github/workflows/deploy.prod.yaml b/.github/workflows/deploy.prod.yaml index 7200cb12..e9f8d02a 100644 --- a/.github/workflows/deploy.prod.yaml +++ b/.github/workflows/deploy.prod.yaml @@ -120,7 +120,7 @@ jobs: -v '/home/ubuntu/global-bundle.pem:/global-bundle.pem' \ ocp-prod:${DEPLOY_TIME} && \ - wait_for_health \"\$CONTAINER_NAME\" && \ + wait_for_health \"\$CONTAINER_NAME\" if [ \$? -eq 0 ]; then handle_container_switch \"\$CONTAINER_NAME\" \"${DEPLOY_TIME}\" \"prod\" else From e4fb387b335e80632a3adfab2a05d329823deef6 Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 11:56:46 -0400 Subject: [PATCH 13/14] Reverted to CJS due to legacy libraries --- .github/workflows/deploy.dev.yaml | 2 +- .github/workflows/deploy.prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.dev.yaml b/.github/workflows/deploy.dev.yaml index 552e8fb2..11b542ee 100644 --- a/.github/workflows/deploy.dev.yaml +++ b/.github/workflows/deploy.dev.yaml @@ -53,7 +53,7 @@ jobs: run: yarn format:check - name: Build Application - run: npx esbuild src/app.js --bundle --platform=node --format=esm --outfile=dist/app.js + run: npx esbuild src/app.js --bundle --platform=node --outfile=dist/app.js - name: Deploy shell: bash diff --git a/.github/workflows/deploy.prod.yaml b/.github/workflows/deploy.prod.yaml index e9f8d02a..3ab0819a 100644 --- a/.github/workflows/deploy.prod.yaml +++ b/.github/workflows/deploy.prod.yaml @@ -53,7 +53,7 @@ jobs: run: yarn format:check - name: Build Application - run: npx esbuild src/app.js --bundle --platform=node --format=esm --outfile=dist/app.js + run: npx esbuild src/app.js --bundle --platform=node --outfile=dist/app.js - name: Deploy shell: bash From a7d08c2496cc06bb6bd66adc64f1217f799d792a Mon Sep 17 00:00:00 2001 From: Thibauld Favre Date: Thu, 19 Jun 2025 12:01:34 -0400 Subject: [PATCH 14/14] Reverted to CJS due to legacy libraries (fix) --- .github/workflows/deploy.dev.yaml | 2 +- .github/workflows/deploy.prod.yaml | 2 +- Dockerfile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.dev.yaml b/.github/workflows/deploy.dev.yaml index 11b542ee..c104198e 100644 --- a/.github/workflows/deploy.dev.yaml +++ b/.github/workflows/deploy.dev.yaml @@ -53,7 +53,7 @@ jobs: run: yarn format:check - name: Build Application - run: npx esbuild src/app.js --bundle --platform=node --outfile=dist/app.js + run: npx esbuild src/app.js --bundle --platform=node --outfile=dist/app.cjs - name: Deploy shell: bash diff --git a/.github/workflows/deploy.prod.yaml b/.github/workflows/deploy.prod.yaml index 3ab0819a..e1bb59ce 100644 --- a/.github/workflows/deploy.prod.yaml +++ b/.github/workflows/deploy.prod.yaml @@ -53,7 +53,7 @@ jobs: run: yarn format:check - name: Build Application - run: npx esbuild src/app.js --bundle --platform=node --outfile=dist/app.js + run: npx esbuild src/app.js --bundle --platform=node --outfile=dist/app.cjs - name: Deploy shell: bash diff --git a/Dockerfile b/Dockerfile index 924b3988..7b7f1f03 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,4 +23,4 @@ COPY . . EXPOSE 8080 # Run the pre-built application -CMD ["node", "dist/app.js"] +CMD ["node", "dist/app.cjs"]