Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions docker-compose.example.yaml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ import select from "@inquirer/select";
import boxen from "boxen";
import chalk from "chalk";

import TrackerList from "tracker-list";
import TrackerList, { defaultTracker } from "tracker-list";

import fs from "fs";
import { exit } from "process";
import { exit, env } from "process";
import { datadir } from "./lib";
import { PROTOCOL_VERSION } from "protocol";

export const SERVER_MILESTONE = "1.0";


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();

if (
Expand Down
2 changes: 2 additions & 0 deletions tracker-list/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ let trackers = {
}
} as const;
export default trackers;

export const defaultTracker = "us-central-1";