-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile-4stage
59 lines (52 loc) · 1.62 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
52
53
54
55
56
57
58
59
### Create docker image from python3.7-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 --upgrade pip wheel setuptools
# Install dependencies and ledfx, remove uneeded packages
RUN apt-get update && apt-get install -y --no-install-recommends \
libatlas3-base \
libavformat58 \
portaudio19-dev \
pulseaudio \
&& apt-get clean -y \
&& 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
### 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"
WORKDIR /ledfx-git
RUN git clone https://github.com/THATDONFC/ledfx -b dev /ledfx-git \
&& cd /ledfx-git/frontend \
&& npm install -g yarn \
&& yarn && yarn build \
&& cd ..
RUN pip install -r requirements.txt
RUN python setup.py build
RUN python setup.py install
# 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 --create-home ledfx --groups audio
WORKDIR /home/ledfx
USER ledfx
EXPOSE 8888/tcp
EXPOSE 5353/udp
ENTRYPOINT [ "ledfx"]