minor changes
This commit is contained in:
parent
909b29dfb5
commit
af2e220116
30 changed files with 598 additions and 350 deletions
|
|
@ -1,22 +1,24 @@
|
|||
# flyctl launch added from .gitignore
|
||||
# General
|
||||
.DS_Store
|
||||
.vscode
|
||||
**/.DS_Store
|
||||
**/.vscode
|
||||
|
||||
# Node
|
||||
node_modules
|
||||
**/node_modules
|
||||
|
||||
# SvelteKit
|
||||
.output
|
||||
.svelte-kit
|
||||
/build
|
||||
/package
|
||||
**/.output
|
||||
**/.svelte-kit
|
||||
build
|
||||
package
|
||||
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
**/.env
|
||||
**/.env.*
|
||||
!**/.env.example
|
||||
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
**/vite.config.js.timestamp-*
|
||||
**/vite.config.ts.timestamp-*
|
||||
|
||||
# Netlify
|
||||
.netlify
|
||||
**/.netlify
|
||||
fly.toml
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
|
||||
|
||||
name: Fly Deploy
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy app
|
||||
runs-on: ubuntu-latest
|
||||
concurrency: deploy-group # optional: ensure only one action runs at a time
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: superfly/flyctl-actions/setup-flyctl@master
|
||||
- run: flyctl deploy --remote-only
|
||||
env:
|
||||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
||||
29
gameboard-service/.github/workflows/release.yaml
vendored
29
gameboard-service/.github/workflows/release.yaml
vendored
|
|
@ -1,29 +0,0 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Tests
|
||||
uses: ./.github/workflows/tests.yaml
|
||||
|
||||
deploy:
|
||||
name: netlify deploy
|
||||
needs: [tests]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: echo ${{ github.event.release.tag_name }} > ./static/version
|
||||
- run: npm ci
|
||||
- run: npm install -g netlify-cli
|
||||
- run: netlify build
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
- run: netlify deploy --prod --message ${{ github.event.release.tag_name }}
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
43
gameboard-service/.github/workflows/tests.yaml
vendored
43
gameboard-service/.github/workflows/tests.yaml
vendored
|
|
@ -1,43 +0,0 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
push: # Branch pushes only, not tags
|
||||
branches:
|
||||
- "**"
|
||||
workflow_call: # Allow other workflows to call this one
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: npm run lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci
|
||||
- run: npm run lint
|
||||
|
||||
check:
|
||||
name: npm run check
|
||||
needs: [lint]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci
|
||||
- run: npm run check
|
||||
|
||||
unit:
|
||||
name: npm run test:unit
|
||||
needs: [check]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci
|
||||
- run: npm run test:unit
|
||||
|
||||
build:
|
||||
name: npm run build
|
||||
needs: [check]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
|
|
@ -1,47 +1,27 @@
|
|||
# syntax = docker/dockerfile:1
|
||||
# Build Stage
|
||||
FROM node:18 AS build
|
||||
|
||||
# Adjust NODE_VERSION as desired
|
||||
ARG NODE_VERSION=22.13.0
|
||||
FROM node:${NODE_VERSION}-slim AS base
|
||||
|
||||
LABEL fly_launch_runtime="SvelteKit"
|
||||
|
||||
# SvelteKit app lives here
|
||||
WORKDIR /app
|
||||
|
||||
# Set production environment
|
||||
ENV NODE_ENV="production"
|
||||
ENV PORT="3005"
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
# 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 .npmrc 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
|
||||
# Serve Stage
|
||||
FROM nginx:stable-alpine
|
||||
|
||||
# Copy built frontend into nginx public folder
|
||||
COPY --from=build /app/build /usr/share/nginx/html
|
||||
|
||||
# Final stage for app image
|
||||
FROM base
|
||||
# Remove default Nginx config
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy built application
|
||||
COPY --from=build /app/build /app/build
|
||||
COPY --from=build /app/node_modules /app/node_modules
|
||||
COPY --from=build /app/package.json /app
|
||||
# Add custom Nginx config
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Start the server by default, this can be overwritten at runtime
|
||||
EXPOSE 3005
|
||||
CMD [ "node", "./build/index.js" ]
|
||||
# Expose port 80 (not 8080 inside container)
|
||||
EXPOSE 3000
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
|
|
|||
|
|
@ -1,20 +1,23 @@
|
|||
app = "gameboard-service-aged-glitter-8141"
|
||||
primary_region = "sea"
|
||||
# fly.toml app configuration file generated for gameboard-service on 2025-06-01T21:09:25-07:00
|
||||
#
|
||||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
|
||||
#
|
||||
|
||||
[env]
|
||||
PORT = "3005"
|
||||
app = 'gameboard-service'
|
||||
primary_region = 'sea'
|
||||
|
||||
[build]
|
||||
|
||||
|
||||
[http_service]
|
||||
internal_port = 3005
|
||||
force_https = true
|
||||
auto_stop_machines = "stop"
|
||||
auto_start_machines = true
|
||||
min_machines_running = 0
|
||||
processes = ["app"]
|
||||
internal_port = 3000
|
||||
force_https = true
|
||||
auto_stop_machines = 'off'
|
||||
auto_start_machines = true
|
||||
min_machines_running = 0
|
||||
processes = ['app']
|
||||
|
||||
[[vm]]
|
||||
memory = "1gb"
|
||||
cpu_kind = "shared"
|
||||
cpus = 1
|
||||
memory = '512mb'
|
||||
cpu_kind = 'shared'
|
||||
cpus = 1
|
||||
|
|
|
|||
25
gameboard-service/nginx.conf
Normal file
25
gameboard-service/nginx.conf
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
server {
|
||||
listen 3000;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Enable compression
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
expires 1h;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
|
||||
# Serve pre-compressed files if they exist
|
||||
location ~ \.(?:js|css|html)$ {
|
||||
gzip_static on;
|
||||
expires 1h;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
}
|
||||
|
|
@ -49,4 +49,4 @@
|
|||
"vitest": "^0.32.2"
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
}
|
||||
|
|
@ -88,8 +88,8 @@ export function engineEventToFrame(
|
|||
|
||||
return {
|
||||
turn: engineGameEvent.Turn,
|
||||
width: engineGameInfo.Game.Width,
|
||||
height: engineGameInfo.Game.Height,
|
||||
width: 11,
|
||||
height: 11,
|
||||
snakes: engineGameEvent.Snakes.map(engineSnakeToSnake),
|
||||
food: engineGameEvent.Food.map(engineCoordsToPoint),
|
||||
hazards: engineGameEvent.Hazards.map(engineCoordsToPoint),
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ export type Settings = {
|
|||
export function getDefaultSettings(): Settings {
|
||||
return {
|
||||
autoplay: false,
|
||||
engine: "https://engine.battlesnake.com",
|
||||
// engine: "https://engine.battlesnake.com",
|
||||
engine: "https://snake-server.fly.dev",
|
||||
fps: 6,
|
||||
game: "",
|
||||
loop: false,
|
||||
|
|
|
|||
|
|
@ -1,23 +1,40 @@
|
|||
// 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-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.
|
||||
// // import adapter from '@sveltejs/adapter-node';
|
||||
// import adapter from '@sveltejs/adapter-node';
|
||||
import adapter from '@sveltejs/adapter-node';
|
||||
// import adapter from "@sveltejs/adapter-static";
|
||||
// // import adapter from "@sveltejs/adapter-static";
|
||||
|
||||
// import { vitePreprocess } from '@sveltejs/kit/vite';
|
||||
|
||||
// /** @type {import('@sveltejs/kit').Config} */
|
||||
// const config = {
|
||||
// // Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||
// // for more information about preprocessors
|
||||
// preprocess: vitePreprocess(),
|
||||
// kit: {
|
||||
// adapter: adapter({
|
||||
// // This option specifies the output directory for the build
|
||||
// out: 'build'
|
||||
// })
|
||||
// }
|
||||
// };
|
||||
|
||||
// export default config;
|
||||
import adapter from '@sveltejs/adapter-static'; // Change this line
|
||||
import { vitePreprocess } from '@sveltejs/kit/vite';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
kit: {
|
||||
adapter: adapter({
|
||||
// This option specifies the output directory for the build
|
||||
out: 'build'
|
||||
pages: 'build',
|
||||
assets: 'build',
|
||||
fallback: 'index.html',
|
||||
precompress: true // Enable Brotli & Gzip precompression
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
||||
export default config;
|
||||
|
|
@ -10,6 +10,6 @@ export default defineConfig({
|
|||
},
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 3005
|
||||
port: 3000
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue