add: docker support

This commit is contained in:
alikia2x (寒寒) 2024-08-26 02:18:15 +08:00
parent 7947b46af5
commit 5d72fa6b64
Signed by: alikia2x
GPG Key ID: 56209E0CCD8420C6
4 changed files with 61 additions and 1 deletions

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# Use the official Bun image as the base image
FROM oven/bun:latest
# Set the working directory inside the container
WORKDIR /app
# Copy the package.json and bun.lockb files to the working directory
COPY package.json bun.lockb ./
# Install dependencies
RUN bun install
# Copy the rest of the application code
COPY . .
# Expose the port the app runs on
EXPOSE 4173
# Command to run the application
CMD ["bun", "go"]

15
docker-compose.yml Normal file
View File

@ -0,0 +1,15 @@
version: '3.8'
services:
aquavox:
build: .
ports:
- "4173:4173"
environment:
- NODE_ENV=production
volumes:
- .:/app
command: ["bun", "go"]
volumes:
node_modules:

View File

@ -1,6 +1,6 @@
{ {
"name": "aquavox", "name": "aquavox",
"version": "2.0.2", "version": "2.0.3",
"private": false, "private": false,
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",

View File

@ -0,0 +1,25 @@
import BezierEasing from 'bezier-easing';
export function smoothScrollTo(element: HTMLElement, to: number, duration: number, timingFunction: Function) {
const start = element.scrollTop;
const change = to - start;
const startTime = performance.now();
function animateScroll(timestamp: number) {
const elapsedTime = timestamp - startTime;
const progress = Math.min(elapsedTime / duration, 1);
const easedProgress = timingFunction(progress, 0.38, 0, 0.24, 0.99);
element.scrollTop = start + change * easedProgress;
if (elapsedTime < duration) {
requestAnimationFrame(animateScroll);
}
}
requestAnimationFrame(animateScroll);
}
// Define your custom Bézier curve function
export function customBezier(progress: number, p1x: number, p1y: number, p2x: number, p2y: number) {
return BezierEasing(p1x, p1y, p2x, p2y)(progress);
}