-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile-4stage
51 lines (44 loc) · 1.47 KB
/
Dockerfile-4stage
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
### Create docker image from python3.9-slim
#
# Set up base venv image to start the build
FROM python:3.9-slim AS venv-image
# Create python venv and add it to PATH
RUN python -m venv /ledfx/venv
ENV PATH="/ledfx/venv/bin:$PATH"
RUN python -m pip install --no-cache-dir --upgrade pip wheel setuptools
# Install dependencies and ledfx, remove unneeded packages
RUN apt-get update && apt-get install -y --no-install-recommends \
alsa-utils \
libatlas3-base \
portaudio19-dev \
pulseaudio && rm -rf /var/lib/apt/lists/*
RUN apt-get clean -y
RUN apt-get autoremove -y
### Create docker image from venv-image as compile-image to speed up builds
#
FROM venv-image AS compile-image
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
git \
libc-dev \
nodejs \
npm \
python3-dev && rm -rf /var/lib/apt/lists/*
### Create docker image from compile-image to pull and build from github
#
FROM compile-image AS build-image
COPY --from=venv-image /ledfx/venv /ledfx/venv
ENV PATH="/ledfx/venv/bin:$PATH"
RUN pip install --no-cache-dir git+https://github.com/LedFx/LedFx@dev
# Create docker image from venv-image to build dist-image
#
FROM venv-image AS dist-image
COPY --from=build-image /ledfx/venv /ledfx/venv
ENV PATH="/ledfx/venv/bin:$PATH"
RUN rm -rf /var/lib/apt/lists/*
RUN useradd -l --create-home ledfx --groups audio
WORKDIR /home/ledfx
USER ledfx
EXPOSE 8888/tcp
EXPOSE 5353/udp
ENTRYPOINT [ "ledfx"]