Skip to content

Commit

Permalink
chore(ci): swap to static site generation
Browse files Browse the repository at this point in the history
  • Loading branch information
CollinHerber committed Jul 10, 2024
1 parent 1da0e0b commit 975c948
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 10 deletions.
17 changes: 9 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
FROM node:20-alpine
WORKDIR /app
COPY . ./
RUN npm install -g pnpm
RUN pnpm install
RUN pnpm run build
# production stage
FROM nginx:alpine as production-stage

EXPOSE 3000
COPY nginx.conf /etc/nginx/nginx.conf
WORKDIR /usr/share/nginx/html

CMD ["npm", "run", "start"]
COPY build/ .

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
25 changes: 25 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
worker_processes 1;

events {
worker_connections 1024;
}

http {
server {
listen 80;
server_name pathofterraria.com;

root /usr/share/nginx/html;
index index.html index.htm;
include /etc/nginx/mime.types;

gzip on;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;

location / {
try_files $uri $uri/ /index.html;
}
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@sveltejs/adapter-auto": "3.2.2",
"@sveltejs/kit": "2.5.18",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"@sveltejs/adapter-static": "^3.0.2",
"axios": "^1.7.2",
"autoprefixer": "^10.4.19",
"flowbite": "^2.4.1",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script>
export const ssr = false;
export const prerender = true;
export const trailingSlash = 'always';
import Header from '$lib/components/Header.svelte';
import './styles.css';
import {SvelteToast} from "@zerodevx/svelte-toast";
Expand Down
12 changes: 10 additions & 2 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
Expand All @@ -11,7 +11,15 @@ const config = {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
adapter: adapter({
// default options are shown. On some platforms
// these options are set automatically — see below
pages: 'build',
assets: 'build',
fallback: '404',
precompress: false,
strict: true
})
}
};

Expand Down

0 comments on commit 975c948

Please sign in to comment.