Initial Docker deployment setup
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM python:3.12-trixie AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ccache \
|
||||
gcc \
|
||||
g++ \
|
||||
libmariadb-dev \
|
||||
make \
|
||||
patch \
|
||||
patchelf \
|
||||
python3-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY upstream/HubBackend/requirements.txt upstream/HubBackend/makefile ./
|
||||
COPY upstream/HubBackend/src ./src
|
||||
COPY upstream/HubBackend/config_sample.json upstream/HubBackend/openapi.json ./
|
||||
COPY docker/client-config.patch ./docker/client-config.patch
|
||||
|
||||
RUN patch -p1 < docker/client-config.patch
|
||||
|
||||
# Compile the binaries from the backend source code. Cache the build data.
|
||||
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||
--mount=type=cache,target=/root/.cache/ccache \
|
||||
make install-python \
|
||||
&& make -j"$(nproc)" build
|
||||
|
||||
FROM debian:trixie-slim AS runtime
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd --system --gid 10001 drivershub \
|
||||
&& useradd --system --uid 10001 --gid drivershub --home-dir /app drivershub
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder --chown=drivershub:drivershub /build/dist/ ./
|
||||
COPY --from=builder --chown=drivershub:drivershub /build/src/external_plugins/ ./external_plugins/
|
||||
COPY --chown=root:root docker/entrypoint.sh /usr/local/bin/drivershub-entrypoint
|
||||
|
||||
USER drivershub
|
||||
EXPOSE 7777 8700
|
||||
|
||||
ENTRYPOINT ["drivershub-entrypoint"]
|
||||
CMD ["drivershub", "--config", "/app/config/config.json", "--banner-service-url", "http://bannergen:8700/banner"]
|
||||
Reference in New Issue
Block a user