mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-10-24 17:29:08 +00:00
Added docker-compose
This commit is contained in:
45
Dockerfile
Normal file
45
Dockerfile
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
# Build stage
|
||||||
|
FROM rust:latest as builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
pkg-config \
|
||||||
|
libssl-dev \
|
||||||
|
protobuf-compiler \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy dependency files
|
||||||
|
COPY Cargo.toml Cargo.lock ./
|
||||||
|
|
||||||
|
# Copy source code
|
||||||
|
COPY src ./src
|
||||||
|
COPY static ./static
|
||||||
|
|
||||||
|
# Build the application
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
# Runtime stage
|
||||||
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Install runtime dependencies
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
ca-certificates \
|
||||||
|
libssl3 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Copy the binary from builder
|
||||||
|
COPY --from=builder /app/target/release/xray-admin /app/xray-admin
|
||||||
|
|
||||||
|
# Copy static files
|
||||||
|
COPY --from=builder /app/static ./static
|
||||||
|
|
||||||
|
# Copy config file
|
||||||
|
COPY config.docker.toml ./config.toml
|
||||||
|
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
CMD ["/app/xray-admin", "--host", "0.0.0.0"]
|
||||||
17
config.docker.toml
Normal file
17
config.docker.toml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
[database]
|
||||||
|
url = "postgres://postgres:postgres@postgres:5432/outfleet"
|
||||||
|
|
||||||
|
[web]
|
||||||
|
host = "0.0.0.0"
|
||||||
|
port = 8081
|
||||||
|
|
||||||
|
[telegram]
|
||||||
|
enabled = false
|
||||||
|
admin_chat_ids = []
|
||||||
|
allowed_users = []
|
||||||
|
|
||||||
|
[xray]
|
||||||
|
config_path = "./templates"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
level = "debug"
|
||||||
45
docker-compose.yml
Normal file
45
docker-compose.yml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
services:
|
||||||
|
admin:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: outfleet-admin
|
||||||
|
ports:
|
||||||
|
- "8081:8081"
|
||||||
|
environment:
|
||||||
|
- DATABASE_URL=postgres://postgres:postgres@postgres:5432/outfleet
|
||||||
|
- RUST_LOG=info
|
||||||
|
- XRAY_ADMIN__WEB__PORT=8081
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
container_name: postgres
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_DB: outfleet
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
xray:
|
||||||
|
image: teddysun/xray:25.8.3
|
||||||
|
container_name: xray-server
|
||||||
|
ports:
|
||||||
|
- "10085:10085"
|
||||||
|
volumes:
|
||||||
|
- ./xray-config.json:/etc/xray/config.json
|
||||||
|
command: ["xray", "-c", "/etc/xray/config.json"]
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
||||||
34
xray-config.json
Normal file
34
xray-config.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"loglevel": "info"
|
||||||
|
},
|
||||||
|
"api": {
|
||||||
|
"tag": "api",
|
||||||
|
"listen": "0.0.0.0:10085",
|
||||||
|
"services": [
|
||||||
|
"HandlerService",
|
||||||
|
"LoggerService",
|
||||||
|
"StatsService"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"stats": {},
|
||||||
|
"policy": {
|
||||||
|
"system": {
|
||||||
|
"statsInboundDownlink": true,
|
||||||
|
"statsInboundUplink": true,
|
||||||
|
"statsOutboundDownlink": true,
|
||||||
|
"statsOutboundUplink": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inbounds": [],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"tag": "direct",
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"routing": {
|
||||||
|
"rules": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user