-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (42 loc) · 2.07 KB
/
Dockerfile
File metadata and controls
56 lines (42 loc) · 2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.12-slim
# Install system dependencies, tesseract with English and German training data, and git client
RUN apt-get update && \
apt-get install -y curl wget sudo gnupg2 git zip tesseract-ocr tesseract-ocr-eng tesseract-ocr-deu && \
rm -rf /var/lib/apt/lists/*
# Install Google Chrome
ENV CHROME_DEB_URL=https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN wget -O /tmp/chrome.deb "$CHROME_DEB_URL" \
&& apt-get update \
&& apt-get install -y /tmp/chrome.deb \
&& rm -f /tmp/chrome.deb
# Create a non-root user
RUN useradd -ms /bin/bash msgo
USER msgo
# Install Node.js (current LTS) and MARP CLI as msgo user
ENV NVM_DIR="/home/msgo/.nvm"
ENV HOME="/home/msgo"
ENV NPM_CONFIG_CACHE="/home/msgo/.npm"
RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash \
&& bash -c "source $NVM_DIR/nvm.sh && nvm install --lts && nvm install-latest-npm && npm cache clean --force && npm install -g --unsafe-perm @marp-team/marp-cli"
# Switch to root to create symlinks in /usr/bin
USER root
RUN ln -s /home/msgo/.nvm/versions/node/$(ls /home/msgo/.nvm/versions/node/ | sort -V | tail -n 1)/bin/node /usr/bin/node \
&& ln -s /home/msgo/.nvm/versions/node/$(ls /home/msgo/.nvm/versions/node/ | sort -V | tail -n 1)/bin/npm /usr/bin/npm \
&& ln -s /home/msgo/.nvm/versions/node/$(ls /home/msgo/.nvm/versions/node/ | sort -V | tail -n 1)/bin/npx /usr/bin/npx \
&& ln -s /home/msgo/.nvm/nvm.sh /usr/bin/nvm
# Switch back to msgo user for app execution
USER msgo
WORKDIR /app
# Copy only top-level files, not subdirectories
COPY *.py *.sh requirements.txt package.json README.md LICENSE /app/
COPY markslidego /app/markslidego
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy .env file for reference (not used for ENV, but available in container)
COPY .env /app/.env
# Set environment variables (user should override via docker-compose or runtime)
ENV TESSERACT_CMD="/usr/bin/tesseract" \
NPX_CMD="/usr/bin/npx" \
MARKSLIDE_DIR="/app/" \
LOGGING_LEVEL="INFO"
CMD ["bash"]