make the docker image a smol bean

Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
Xe Iaso 2024-09-17 19:45:30 -04:00
parent ffd029cdbb
commit ba7d0f20bf
4 changed files with 12 additions and 40 deletions

View File

@ -1,44 +1,34 @@
VERSION 0.8 VERSION 0.8
# Adjust NODE_VERSION as desired ARG NODE_VERSION=22
ARG NODE_VERSION=22.3.0
FROM node:${NODE_VERSION}-slim FROM node:${NODE_VERSION}-slim
LABEL fly_launch_runtime="Next.js"
# Next.js app lives here
WORKDIR /app WORKDIR /app
# Set production environment
ENV NODE_ENV="production" ENV NODE_ENV="production"
build: build:
# Install packages needed to build node modules
RUN apt-get update -qq && \ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3 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 ./ COPY package-lock.json package.json ./
RUN npm ci --include=dev RUN npm ci --include=dev
# Copy application code
COPY . . COPY . .
# Build application
RUN npm run build RUN npm run build
# Remove development dependencies
RUN npm prune --omit=dev RUN npm prune --omit=dev
SAVE ARTIFACT /app SAVE ARTIFACT /app
run: run:
# Copy built application COPY +build/app/.next/standalone /app
COPY +build/app /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 EXPOSE 3000
CMD [ "npm", "run", "start" ] CMD [ "node", "server.js" ]
SAVE IMAGE --push ghcr.io/xe/techaro-lol SAVE IMAGE --push ghcr.io/xe/techaro-lol

View File

@ -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

View File

@ -1,4 +1,7 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = {};
const nextConfig = {
output: "standalone",
};
export default nextConfig; export default nextConfig;

View File

@ -6,7 +6,8 @@
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "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": { "dependencies": {
"@arcjet/next": "^1.0.0-alpha.24", "@arcjet/next": "^1.0.0-alpha.24",