Merge 4050de78b6 into 82d84e3edd
This commit is contained in:
commit
e4238eb1ac
3 changed files with 69 additions and 20 deletions
|
|
@ -7,9 +7,7 @@
|
||||||
"context": "..",
|
"context": "..",
|
||||||
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
|
||||||
"dockerfile": "../Dockerfile",
|
"dockerfile": "../Dockerfile",
|
||||||
"args": {
|
"target": "development"
|
||||||
"INSTALL_GIT": "true"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||||
|
|
@ -17,6 +15,14 @@
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers-extra/features/hatch:2": {}
|
"ghcr.io/devcontainers-extra/features/hatch:2": {}
|
||||||
},
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"ms-python.python",
|
||||||
|
"charliermarsh.ruff"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
||||||
// "forwardPorts": [],
|
// "forwardPorts": [],
|
||||||
|
|
@ -28,5 +34,5 @@
|
||||||
// "customizations": {},
|
// "customizations": {},
|
||||||
|
|
||||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
||||||
"remoteUser": "root"
|
// "remoteUser": "root"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,9 @@
|
||||||
*
|
**/coverage
|
||||||
|
**/.env
|
||||||
|
**/.aws
|
||||||
|
**/.ssh
|
||||||
|
Dockerfile
|
||||||
|
docker-compose.yml
|
||||||
|
**/.DS_Store
|
||||||
|
**/venv
|
||||||
|
**/env
|
||||||
65
Dockerfile
65
Dockerfile
|
|
@ -1,23 +1,58 @@
|
||||||
FROM python:3.13-slim-bullseye
|
# FFmpeg stage
|
||||||
|
FROM jrottenberg/ffmpeg:4.1-scratch AS ffmpeg
|
||||||
|
|
||||||
USER root
|
# Development stage
|
||||||
|
FROM python:3.13-bullseye AS development
|
||||||
|
|
||||||
ARG INSTALL_GIT=false
|
COPY --from=ffmpeg / /
|
||||||
RUN if [ "$INSTALL_GIT" = "true" ]; then \
|
|
||||||
apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Runtime dependency
|
ENV PYTHONUNBUFFERED=1 \
|
||||||
|
PYTHONDONTWRITEBYTECODE=1
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
ffmpeg \
|
build-essential \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN pip install markitdown
|
RUN pip install --no-cache-dir hatch
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
COPY . /app/
|
||||||
|
|
||||||
|
# Build stage
|
||||||
|
FROM python:3.13-bullseye AS build
|
||||||
|
|
||||||
|
# Install build dependencies
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir hatch
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY pyproject.toml /app/
|
||||||
|
COPY . /app/
|
||||||
|
|
||||||
|
RUN hatch build
|
||||||
|
|
||||||
|
# Production stage
|
||||||
|
FROM python:3.13-slim-bullseye AS production
|
||||||
|
|
||||||
|
# Copy ffmpeg binaries
|
||||||
|
COPY --from=ffmpeg / /
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=build /app/dist /tmp/dist
|
||||||
|
|
||||||
|
RUN pip install --no-cache-dir /tmp/dist/markitdown-*.whl
|
||||||
|
|
||||||
# Default USERID and GROUPID
|
# Default USERID and GROUPID
|
||||||
ARG USERID=10000
|
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
||||||
ARG GROUPID=10000
|
USER appuser
|
||||||
|
|
||||||
USER $USERID:$GROUPID
|
# Entrypoint
|
||||||
|
ENTRYPOINT ["markitdown"]
|
||||||
ENTRYPOINT [ "markitdown" ]
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue