demo nsenter approach to execute command in another container
This commit is contained in:
21
fastapi-nsenter/Dockerfile
Normal file
21
fastapi-nsenter/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM alpine:3.21 AS base
|
||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk upgrade
|
||||
|
||||
FROM base AS soffice
|
||||
RUN apk add --no-cache libreoffice musl-locales font-wqy-zenhei
|
||||
VOLUME /data
|
||||
CMD /bin/sh -c "echo \$\$ > /data/libreoffice.pid; while true; do sleep 1000000; done"
|
||||
|
||||
FROM base AS venv-builder
|
||||
RUN apk add python3-dev uv gcc musl-dev linux-headers
|
||||
WORKDIR /app
|
||||
COPY requirements.txt .
|
||||
RUN uv venv -i https://mirrors.aliyun.com/pypi/simple && uv pip install -i https://mirrors.aliyun.com/pypi/simple -r requirements.txt
|
||||
|
||||
FROM base AS service
|
||||
RUN apk add python3
|
||||
COPY --from=venv-builder /app/.venv /app/.venv
|
||||
COPY ./ /app/
|
||||
WORKDIR /app
|
||||
VOLUME /data
|
||||
CMD /app/entrypoint.sh
|
Reference in New Issue
Block a user