-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
32 lines (25 loc) · 828 Bytes
/
Dockerfile
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
FROM balenalib/raspberrypi4-64-debian-python:latest
# Set working directory
WORKDIR /usr/src/app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
cron \
virtualenv \
espeak \
mpc \
mpd
# Create a virtual environment and activate it
RUN virtualenv venv
# If you have a requirements.txt, copy and install using pip within the virtual environment
COPY requirements.txt ./
RUN . venv/bin/activate && pip install --no-cache-dir -r requirements.txt
# Create a non-root user (optional but recommended for security)
RUN useradd -m pi
# Copy the rest of your project
COPY . .
USER root
RUN chown -R pi:pi /usr/src/app/
USER pi
# Set the default command for the container using the virtual environment's Python
CMD [ "venv/bin/python", "./server.py" ]