-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
48 lines (35 loc) · 1.1 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
# Dockerfile
FROM python:3.13-slim
LABEL maintainer="Eric Bower"
ENV APP_ROOT=/app
ENV PIPER_VOICES_DIR=/voices
ENV LOG_DIR=/log
ENV AUDIO_DIR=/audio
ENV PIPER_VOICE_ID=en_GB-alan-medium
ENV PYTHONUNBUFFERED=1
ARG IMAGE_VERSION
ENV IMAGE_VERSION=${IMAGE_VERSION}
# Create necessary directories
RUN mkdir -p ${APP_ROOT} ${LOG_DIR} ${AUDIO_DIR} ${PIPER_VOICES_DIR}
# System dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
ffmpeg libopus0 libsodium23 ca-certificates curl espeak \
&& rm -rf /var/lib/apt/lists/*
# Copy bot source code
COPY ./src/* ${APP_ROOT}/
COPY requirements.txt ${APP_ROOT}/
COPY LICENSE ${APP_ROOT}/
WORKDIR ${APP_ROOT}
# Install any needed packages
RUN pip install --no-cache-dir -r requirements.txt
# Add entrypoint
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Create a non-root user
RUN useradd -m botuser
RUN chown -R botuser:botuser ${APP_ROOT} ${LOG_DIR} ${AUDIO_DIR} ${PIPER_VOICES_DIR}
# Use the non-root user
USER botuser
ENTRYPOINT ["docker-entrypoint.sh"]
# Run your bot
CMD ["python", "bot.py"]