Skip to content

Commit

Permalink
Fix broken production build on Node 22.5 (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakycrow authored Jul 19, 2024
1 parent b518c93 commit 9c68dc8
Show file tree
Hide file tree
Showing 7 changed files with 339 additions and 608 deletions.
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
FROM node:22 as base
# Issue with 22.5.0, https://github.com/nodejs/docker-node/issues/2119
FROM node:22.4 as base

LABEL fly_launch_runtime="Node.js"

# Node.js app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV=production

# Throw-away build stage to reduce size of final image
FROM base as build

Expand All @@ -19,8 +17,9 @@ RUN apt-get update -qq && \
apt-get install -y python-is-python3 pkg-config build-essential

# Install node modules
COPY --link .npmrc yarn.lock package.json ./
RUN yarn install --frozen-lockfile
ENV DEBUG='vite:*'
COPY --link .yarnrc yarn.lock package.json ./
RUN yarn install

# Copy application code
COPY --link . .
Expand All @@ -38,7 +37,6 @@ RUN apt-get update -qq && \
# Copy built application
COPY --from=build /app /app

ENV MODE=production
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "yarn", "start" ]
5 changes: 5 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image_name := "github.com/sneakycrow/website"
image_tag := "latest"

build-docker:
docker build -t {{image_name}}:{{image_tag}} .
8 changes: 1 addition & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"name": "web",
"version": "0.1.0",
"private": true,
"type": "module",
"engines": {
"node": ">=18"
},
"scripts": {
"dev": "vite dev",
"build": "npx prisma generate && vite build",
Expand Down Expand Up @@ -44,9 +40,7 @@
"tslib": "^2.4.1",
"typescript": "^5.4.5",
"uuid": "^10.0.0",
"vite": "^4.4.2",
"vite-plugin-top-level-await": "^1.3.1",
"vite-plugin-wasm": "^3.2.2"
"vite": "^4.4.2"
},
"overrides": {
"svelte-markdown": {
Expand Down
6 changes: 1 addition & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { sentrySvelteKit } from "@sentry/sveltekit";
import { sveltekit } from "@sveltejs/kit/vite";
import { defineConfig } from "vite";
import topLevelAwait from "vite-plugin-top-level-await";
import wasm from "vite-plugin-wasm";

export default defineConfig({
plugins: [
Expand All @@ -12,8 +10,6 @@ export default defineConfig({
project: "sneakycrow-dev"
}
}),
sveltekit(),
wasm(),
topLevelAwait()
sveltekit()
]
});
913 changes: 326 additions & 587 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 9c68dc8

Please sign in to comment.