initial commit
This commit is contained in:
3
docker/.env.example
Normal file
3
docker/.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
GUILDLIB_API_KEY=changeme-use-a-real-secret
|
||||
# PORT=3000
|
||||
# DOMAIN=guildlib.yourgame.com
|
||||
4
docker/Caddyfile
Normal file
4
docker/Caddyfile
Normal file
@@ -0,0 +1,4 @@
|
||||
{$DOMAIN:localhost} {
|
||||
reverse_proxy guildlib:3000
|
||||
encode gzip
|
||||
}
|
||||
17
docker/Dockerfile
Normal file
17
docker/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
FROM oven/bun:1 AS base
|
||||
WORKDIR /app
|
||||
COPY package.json bun.lockb* ./
|
||||
RUN bun install --frozen-lockfile --production
|
||||
COPY src ./src
|
||||
|
||||
FROM oven/bun:1-distroless AS runtime
|
||||
WORKDIR /app
|
||||
COPY --from=base /app/node_modules ./node_modules
|
||||
COPY --from=base /app/src ./src
|
||||
COPY --from=base /app/package.json ./
|
||||
VOLUME ["/app/shards", "/app/config"]
|
||||
ENV PORT=3000
|
||||
ENV SHARD_DIR=/app/shards
|
||||
ENV SCHEMA_PATH=/app/config/schema.json
|
||||
EXPOSE 3000
|
||||
CMD ["bun", "run", "src/index.ts"]
|
||||
45
docker/docker-compose.yml
Normal file
45
docker/docker-compose.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
version: "3.9"
|
||||
|
||||
services:
|
||||
guildlib:
|
||||
build:
|
||||
context: ../server
|
||||
dockerfile: ../docker/Dockerfile
|
||||
container_name: guildlib-server
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
PORT: "3000"
|
||||
SHARD_DIR: /app/shards
|
||||
SCHEMA_PATH: /app/config/schema.json
|
||||
GUILDLIB_API_KEY: "${GUILDLIB_API_KEY:-changeme}"
|
||||
volumes:
|
||||
- guildlib-shards:/app/shards
|
||||
- guildlib-config:/app/config
|
||||
ports:
|
||||
- "3000:3000"
|
||||
healthcheck:
|
||||
test: ["CMD", "bun", "-e", "fetch('http://localhost:3000/health').then(r=>r.ok||process.exit(1))"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
|
||||
# Uncomment + set DOMAIN in .env for production HTTPS
|
||||
# caddy:
|
||||
# image: caddy:2-alpine
|
||||
# container_name: guildlib-caddy
|
||||
# restart: unless-stopped
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# volumes:
|
||||
# - ./Caddyfile:/etc/caddy/Caddyfile
|
||||
# - caddy-data:/data
|
||||
# - caddy-config:/config
|
||||
# depends_on:
|
||||
# - guildlib
|
||||
|
||||
volumes:
|
||||
guildlib-shards:
|
||||
guildlib-config:
|
||||
# caddy-data:
|
||||
# caddy-config:
|
||||
Reference in New Issue
Block a user