Switch to using Docker file deployment
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.env
|
||||||
|
downloads
|
||||||
|
packages/client/dist
|
||||||
|
packages/server/dist
|
||||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Use the official Bun image
|
||||||
|
FROM oven/bun:1.1.3
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files first for caching
|
||||||
|
COPY package.json bun.lockb ./
|
||||||
|
COPY packages/client/package.json ./packages/client/
|
||||||
|
COPY packages/server/package.json ./packages/server/
|
||||||
|
COPY packages/shared/package.json ./packages/shared/
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN bun install --frozen-lockfile
|
||||||
|
|
||||||
|
# Copy the rest of the application
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the client (Vite) and server (TSC)
|
||||||
|
# ensuring the environment variables are set for the build if needed
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
RUN bun --filter "*" build
|
||||||
|
|
||||||
|
# Expose the port (Dokku will override PORT env var, but 3000 is a good default documentation)
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
# Start the server
|
||||||
|
CMD ["bun", "packages/server/src/index.ts"]
|
||||||
1
MagnetLink.txt
Normal file
1
MagnetLink.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
magnet:?xt=urn:btih:A18230D43BDA105BE7DEF84CB711859018AAA92D&dn=Snow%20Crash%20by%20Neal%20Stephenson%20EPUB&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.torrent.eu.org%3A451%2Fannounce&tr=udp%3A%2F%2Ftracker.bittor.pw%3A1337%2Fannounce&tr=udp%3A%2F%2Fpublic.popcorn-tracker.org%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969&tr=udp%3A%2F%2Fopen.demonii.com%3A1337%2Fannounce&tr=udp%3A%2F%2Fglotorrents.pw%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Ftorrent.gresille.org%3A80%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
console.log("Imports loading...");
|
|
||||||
import { parseMagnetURI, BencodeDecoder, BencodeEncoder, MetadataReassembler } from "@torrent-client/shared";
|
import { parseMagnetURI, BencodeDecoder, BencodeEncoder, MetadataReassembler } from "@torrent-client/shared";
|
||||||
console.log("Shared loaded");
|
|
||||||
import dgram from "node:dgram";
|
import dgram from "node:dgram";
|
||||||
import crypto from "node:crypto";
|
import crypto from "node:crypto";
|
||||||
import { join } from "node:path";
|
import { join } from "node:path";
|
||||||
import { TorrentManager } from "./engine";
|
import { TorrentManager } from "./engine";
|
||||||
console.log("Engine loaded");
|
|
||||||
|
|
||||||
const port = process.env.PORT || 3001;
|
const port = process.env.PORT || 3001;
|
||||||
const getCONFIG = () => ({
|
const getCONFIG = () => ({
|
||||||
@@ -312,18 +309,9 @@ export async function handleRequest(req: Request): Promise<Response> {
|
|||||||
return new Response(Bun.file(join(distPath, "index.html")));
|
return new Response(Bun.file(join(distPath, "index.html")));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Server process starting...");
|
if (process.env.NODE_ENV !== "test") {
|
||||||
|
Bun.serve({
|
||||||
try {
|
port: port,
|
||||||
if (process.env.NODE_ENV !== "test") {
|
fetch: handleRequest
|
||||||
console.log(`Attempting to bind parameters: PORT=${port}`);
|
});
|
||||||
const server = Bun.serve({
|
|
||||||
port: port,
|
|
||||||
fetch: handleRequest
|
|
||||||
});
|
|
||||||
console.log(`Server successfully listening on port ${server.port}`);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error("CRITICAL SERVER STARTUP ERROR:", e);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user