docker container for dns
This commit is contained in:
56
dns/Dockerfile
Normal file
56
dns/Dockerfile
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
FROM rust:1.75-alpine AS builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
musl-dev \
|
||||||
|
openssl-dev \
|
||||||
|
openssl-libs-static \
|
||||||
|
pkgconfig \
|
||||||
|
postgresql-dev
|
||||||
|
|
||||||
|
ENV OPENSSL_STATIC=1
|
||||||
|
ENV OPENSSL_DIR=/usr
|
||||||
|
ENV PKG_CONFIG_ALLOW_CROSS=1
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY ../protocol/library ./protocol/library
|
||||||
|
|
||||||
|
COPY Cargo.toml Cargo.lock ./
|
||||||
|
|
||||||
|
RUN mkdir src && \
|
||||||
|
echo "fn main() {}" > src/main.rs && \
|
||||||
|
cargo build --release && \
|
||||||
|
rm src/main.rs
|
||||||
|
|
||||||
|
COPY src ./src
|
||||||
|
COPY migrations ./migrations
|
||||||
|
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
postgresql-client
|
||||||
|
|
||||||
|
RUN addgroup -g 1001 -S appgroup && \
|
||||||
|
adduser -u 1001 -S appuser -G appgroup
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/target/release/webx_dns /app/webx_dns
|
||||||
|
|
||||||
|
COPY --from=builder /app/migrations ./migrations
|
||||||
|
|
||||||
|
RUN mkdir -p /app/config /app/data && \
|
||||||
|
chown -R appuser:appgroup /app
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
|
||||||
|
|
||||||
|
# Default command
|
||||||
|
CMD ["./webx_dns", "--config", "/app/config/config.toml", "start"]
|
||||||
24
dns/docker-compose.yml
Normal file
24
dns/docker-compose.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
dns-server:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: gurted-dns-server
|
||||||
|
environment:
|
||||||
|
RUST_LOG: info
|
||||||
|
volumes:
|
||||||
|
- ./config/docker-config.toml:/app/config/config.toml:ro
|
||||||
|
- ./data:/app/data
|
||||||
|
- ./certs:/app/certs:ro
|
||||||
|
- ./localhost+2.pem:/app/config/tls.pem:ro
|
||||||
|
- ./localhost+2-key.pem:/app/config/tls-key.pem:ro
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
networks:
|
||||||
|
- gurted-network
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
restart: unless-stopped
|
||||||
@@ -50,7 +50,7 @@ impl Default for GurtClientConfig {
|
|||||||
enable_connection_pooling: true,
|
enable_connection_pooling: true,
|
||||||
max_connections_per_host: 4,
|
max_connections_per_host: 4,
|
||||||
custom_ca_certificates: Vec::new(),
|
custom_ca_certificates: Vec::new(),
|
||||||
dns_server_ip: "127.0.0.1".to_string(),
|
dns_server_ip: "135.125.163.131".to_string(),
|
||||||
dns_server_port: 8877,
|
dns_server_port: 8877,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user