From ba7d0f20bf72d40ba655fa8fbdd7bc338effcca6 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Tue, 17 Sep 2024 19:45:30 -0400 Subject: [PATCH] make the docker image a smol bean Signed-off-by: Xe Iaso --- Earthfile | 20 +++++--------------- fly.toml | 22 ---------------------- next.config.mjs | 5 ++++- package.json | 5 +++-- 4 files changed, 12 insertions(+), 40 deletions(-) delete mode 100644 fly.toml diff --git a/Earthfile b/Earthfile index 4e54228..ae22762 100644 --- a/Earthfile +++ b/Earthfile @@ -1,44 +1,34 @@ VERSION 0.8 -# Adjust NODE_VERSION as desired -ARG NODE_VERSION=22.3.0 +ARG NODE_VERSION=22 FROM node:${NODE_VERSION}-slim -LABEL fly_launch_runtime="Next.js" - -# Next.js app lives here WORKDIR /app -# Set production environment ENV NODE_ENV="production" build: - # Install packages needed to build node modules RUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 - # Install node modules COPY package-lock.json package.json ./ RUN npm ci --include=dev - # Copy application code COPY . . - # Build application RUN npm run build - # Remove development dependencies RUN npm prune --omit=dev SAVE ARTIFACT /app run: - # Copy built application - COPY +build/app /app + COPY +build/app/.next/standalone /app + COPY +build/app/.next/static /app/.next/static + COPY +build/app/public /app/public - # Start the server by default, this can be overwritten at runtime EXPOSE 3000 - CMD [ "npm", "run", "start" ] + CMD [ "node", "server.js" ] SAVE IMAGE --push ghcr.io/xe/techaro-lol \ No newline at end of file diff --git a/fly.toml b/fly.toml deleted file mode 100644 index 3f24f4e..0000000 --- a/fly.toml +++ /dev/null @@ -1,22 +0,0 @@ -# fly.toml app configuration file generated for techaro on 2024-07-01T10:58:51-04:00 -# -# See https://fly.io/docs/reference/configuration/ for information about how to use this file. -# - -app = 'techaro' -primary_region = 'yul' - -[build] - -[http_service] - internal_port = 3000 - force_https = true - auto_stop_machines = true - auto_start_machines = true - min_machines_running = 0 - processes = ['app'] - -[[vm]] - memory = '1gb' - cpu_kind = 'shared' - cpus = 1 diff --git a/next.config.mjs b/next.config.mjs index 4678774..e5f6467 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,4 +1,7 @@ /** @type {import('next').NextConfig} */ -const nextConfig = {}; + +const nextConfig = { + output: "standalone", +}; export default nextConfig; diff --git a/package.json b/package.json index 8039587..b3bd1d3 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "deploy": "earthly --push +run && kubectl apply -k manifest && kubectl rollout restart -n default deployment/techaro-lol" }, "dependencies": { "@arcjet/next": "^1.0.0-alpha.24", @@ -26,4 +27,4 @@ "tailwindcss": "^3.4.1", "typescript": "^5" } -} +} \ No newline at end of file