Test fly deployment

This commit is contained in:
2024-03-09 23:03:52 +00:00
parent 8a9d1c6aa8
commit 5e0d4ffef5
4 changed files with 93 additions and 1 deletions

21
.dockerignore Normal file
View File

@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

49
Dockerfile Normal file
View File

@@ -0,0 +1,49 @@
# syntax = docker/dockerfile:1
# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.17.0
FROM node:${NODE_VERSION}-slim as base
LABEL fly_launch_runtime="Astro"
# Astro app lives here
WORKDIR /app
# Set production environment
ENV NODE_ENV="production"
# Install pnpm
ARG PNPM_VERSION=8.9.2
RUN npm install -g pnpm@$PNPM_VERSION
# Throw-away build stage to reduce size of final image
FROM base as 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 --link package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod=false
# Copy application code
COPY --link . .
# Build application
RUN pnpm run build
# Remove development dependencies
RUN pnpm prune --prod
# Final stage for app image
FROM nginx
# Copy built application
COPY --from=build /app/dist /usr/share/nginx/html
# Start the server by default, this can be overwritten at runtime
EXPOSE 80
CMD [ "/usr/sbin/nginx", "-g", "daemon off;" ]

22
fly.toml Normal file
View File

@@ -0,0 +1,22 @@
# fly.toml app configuration file generated for kennethnym-website on 2024-03-09T22:59:26Z
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'kennethnym-website'
primary_region = 'lhr'
[build]
[http_service]
internal_port = 80
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,6 +1,6 @@
import rss from "@astrojs/rss";
import { SITE_TITLE, SITE_DESCRIPTION } from "../consts";
import { getBlogs } from "../content/blog.js";
import { getBlogs } from "../content/blog";
export async function GET(context) {
const posts = await getBlogs();