55 lines
1.3 KiB
Docker
55 lines
1.3 KiB
Docker
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 dns/Cargo.toml ./
|
|
COPY dns/src ./src
|
|
COPY dns/migrations ./migrations
|
|
|
|
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/webx_dns /app/webx_dns
|
|
COPY --from=builder /app/migrations ./migrations
|
|
COPY dns/frontend ./frontend
|
|
COPY search-engine/frontend ./search-engine/frontend
|
|
|
|
RUN mkdir -p /app/config /app/data /home/matt/gurted/dns/certs && \
|
|
chown -R appuser:appgroup /app && \
|
|
chown -R appuser:appgroup /home/matt && \
|
|
ls -la /home/matt/gurted/dns/ && \
|
|
echo "Directory structure created successfully"
|
|
|
|
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 ["sh", "-c", "ls -la /home/matt/gurted/dns/certs/ && ./webx_dns --config /app/config/config.toml start"]
|