search engine docker
This commit is contained in:
48
search-engine/Dockerfile
Normal file
48
search-engine/Dockerfile
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
FROM rustlang/rust:nightly-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 search-engine/Cargo.toml ./
|
||||||
|
COPY search-engine/src ./src
|
||||||
|
|
||||||
|
RUN cargo build --release
|
||||||
|
|
||||||
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
RUN apk add --no-cache \
|
||||||
|
ca-certificates \
|
||||||
|
postgresql-client \
|
||||||
|
wget
|
||||||
|
|
||||||
|
RUN addgroup -g 1001 -S appgroup && \
|
||||||
|
adduser -u 1001 -S appuser -G appgroup
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=builder /app/target/release/gurted-search-engine /app/gurted-search-engine
|
||||||
|
COPY search-engine/frontend ./frontend
|
||||||
|
|
||||||
|
RUN mkdir -p /app/config /app/data /app/search_indexes /app/certs && \
|
||||||
|
chown -R appuser:appgroup /app
|
||||||
|
|
||||||
|
USER appuser
|
||||||
|
|
||||||
|
EXPOSE 8081
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
|
CMD wget --no-verbose --tries=1 --spider http://localhost:8081/health || exit 1
|
||||||
|
|
||||||
|
# Default command - runs the server subcommand
|
||||||
|
CMD ["./gurted-search-engine", "--config", "/app/config/config.toml", "server"]
|
||||||
15
search-engine/build.sh
Normal file
15
search-engine/build.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Building Gurted Search Engine Server..."
|
||||||
|
|
||||||
|
echo "Stopping existing container..."
|
||||||
|
docker compose down
|
||||||
|
|
||||||
|
echo "Building Docker image..."
|
||||||
|
docker compose build --no-cache --parallel
|
||||||
|
|
||||||
|
echo "Starting services..."
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
echo "Container logs (press Ctrl+C to stop following):"
|
||||||
|
docker compose logs -f search-engine
|
||||||
14
search-engine/docker-compose.yml
Normal file
14
search-engine/docker-compose.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
services:
|
||||||
|
search-engine:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: search-engine/Dockerfile
|
||||||
|
container_name: gurted-search-engine
|
||||||
|
network_mode: host
|
||||||
|
environment:
|
||||||
|
RUST_LOG: info
|
||||||
|
volumes:
|
||||||
|
- ./config.toml:/app/config/config.toml:ro
|
||||||
|
- ./search_indexes:/app/search_indexes
|
||||||
|
- ./certs:/app/certs:ro
|
||||||
|
restart: unless-stopped
|
||||||
Reference in New Issue
Block a user