mirror of
https://github.com/MercuryWorkshop/adrift.git
synced 2025-05-12 22:00:02 -04:00
Dockerfile???
This commit is contained in:
parent
4ae9805519
commit
4e033acf6e
4 changed files with 41 additions and 2 deletions
17
Dockerfile
Normal file
17
Dockerfile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
FROM node:18-alpine as build
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
COPY ["./*", "/build"]
|
||||||
|
|
||||||
|
RUN cd server && node esbuild.bundle.js
|
||||||
|
|
||||||
|
FROM node:18-alpine as runtime
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
ENV ADRIFT_IS_DOCKER true
|
||||||
|
|
||||||
|
COPY --from=build ["/build/server/*", "/app"]
|
||||||
|
|
||||||
|
ENTRYPOINT [ "node", "dist/main.js", "--start"]
|
14
docker-compose.example.yaml
Normal file
14
docker-compose.example.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
services:
|
||||||
|
adrift:
|
||||||
|
image: mercuryworkshop/adrift-server
|
||||||
|
environment:
|
||||||
|
# You don't have to set this or the type
|
||||||
|
- ADRIFT_TRACKER: "us-central-1"
|
||||||
|
- ADRIFT_TYPE: "swarm"
|
||||||
|
# Only used with "account" type
|
||||||
|
#- ADRIFT_CREDENTIALS: '{"email": "", "password": ""}'
|
||||||
|
# Auto update docker image
|
||||||
|
watchtower:
|
||||||
|
image: containrrr/watchtower
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
@ -13,10 +13,10 @@ import select from "@inquirer/select";
|
||||||
import boxen from "boxen";
|
import boxen from "boxen";
|
||||||
import chalk from "chalk";
|
import chalk from "chalk";
|
||||||
|
|
||||||
import TrackerList from "tracker-list";
|
import TrackerList, { defaultTracker } from "tracker-list";
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { exit } from "process";
|
import { exit, env } from "process";
|
||||||
import { datadir } from "./lib";
|
import { datadir } from "./lib";
|
||||||
import { PROTOCOL_VERSION } from "protocol";
|
import { PROTOCOL_VERSION } from "protocol";
|
||||||
|
|
||||||
|
@ -24,6 +24,12 @@ export const SERVER_MILESTONE = "1.0";
|
||||||
|
|
||||||
|
|
||||||
async function config() {
|
async function config() {
|
||||||
|
if(env.ADRIFT_IS_DOCKER) return {
|
||||||
|
/* Default values so users can just docker run the image */
|
||||||
|
tracker: env.ADRIFT_TRACKER || defaultTracker,
|
||||||
|
type: env.ADRIFT_TYPE || "swarm",
|
||||||
|
credentials: env.ADRIFT_CREDENTIALS ? JSON.parse(env.ADRIFT_CREDENTIALS) : {}
|
||||||
|
};
|
||||||
let dir = datadir();
|
let dir = datadir();
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -28,3 +28,5 @@ let trackers = {
|
||||||
}
|
}
|
||||||
} as const;
|
} as const;
|
||||||
export default trackers;
|
export default trackers;
|
||||||
|
|
||||||
|
export const defaultTracker = "us-central-1";
|
Loading…
Add table
Add a link
Reference in a new issue