|
1 | 1 | # Mesa3D Software Drivers
|
2 |
| -# |
3 |
| -# VERSION 18.0.1 |
4 | 2 |
|
5 |
| -FROM alpine:3.7 |
| 3 | +FROM alpine:3.10 as builder |
6 | 4 |
|
7 |
| -# Build arguments. |
8 |
| -ARG VCS_REF |
9 |
| -ARG BUILD_DATE |
10 |
| -ARG MESA_DEMOS="false" |
11 |
| - |
12 |
| -# Labels / Metadata. |
13 |
| -LABEL maintainer= "James Brink, [email protected]" \ |
14 |
| - decription="Mesa3D Software Drivers" \ |
15 |
| - version="18.0.1" \ |
16 |
| - org.label-schema.name="Mesa3D-Software-Drivers" \ |
17 |
| - org.label-schema.build-date=$BUILD_DATE \ |
18 |
| - org.label-schema.vcs-ref=$VCS_REF \ |
19 |
| - org.label-schema.vcs-url="https://github.com/jamesbrink/docker-gource" \ |
20 |
| - org.label-schema.schema-version="1.0.0-rc1" |
| 5 | +# Install all needed build deps for Mesa |
| 6 | +RUN set -xe; \ |
| 7 | + apk add --no-cache --virtual .build-deps \ |
| 8 | + autoconf \ |
| 9 | + automake \ |
| 10 | + bison \ |
| 11 | + build-base \ |
| 12 | + expat-dev \ |
| 13 | + flex \ |
| 14 | + gettext \ |
| 15 | + git \ |
| 16 | + glproto \ |
| 17 | + libtool \ |
| 18 | + llvm7 \ |
| 19 | + llvm7-dev \ |
| 20 | + py-mako \ |
| 21 | + xorg-server-dev python-dev \ |
| 22 | + zlib-dev; |
21 | 23 |
|
22 |
| -# Install all needed deps and compile the mesa llvmpipe driver from source. |
| 24 | +# Clone Mesa source repo. (this step caches) |
| 25 | +# Due to ongoing packaging issues we build from git vs tar packages |
| 26 | +# Refer to https://bugs.freedesktop.org/show_bug.cgi?id=107865 |
23 | 27 | RUN set -xe; \
|
24 |
| - apk --update add --no-cache --virtual .runtime-deps xvfb llvm5-libs xdpyinfo; \ |
25 |
| - apk add --no-cache --virtual .build-deps llvm-dev build-base zlib-dev glproto xorg-server-dev python-dev; \ |
26 | 28 | mkdir -p /var/tmp/build; \
|
27 | 29 | cd /var/tmp/build; \
|
28 |
| - wget "https://mesa.freedesktop.org/archive/mesa-18.0.1.tar.gz"; \ |
29 |
| - tar xfv mesa-18.0.1.tar.gz; \ |
30 |
| - rm mesa-18.0.1.tar.gz; \ |
31 |
| - cd mesa-18.0.1; \ |
32 |
| - ./configure --enable-glx=gallium-xlib --with-gallium-drivers=swrast,swr --disable-dri --disable-gbm --disable-egl --enable-gallium-osmesa --prefix=/usr/local; \ |
33 |
| - make; \ |
34 |
| - make install; \ |
35 |
| - cd .. ; \ |
36 |
| - rm -rf mesa-18.0.1; \ |
37 |
| - if [ "${MESA_DEMOS}" == "true" ]; then \ |
38 |
| - apk add --no-cache --virtual .mesa-demos-runtime-deps glu glew \ |
39 |
| - && apk add --no-cache --virtual .mesa-demos-build-deps glew-dev freeglut-dev \ |
40 |
| - && wget "ftp://ftp.freedesktop.org/pub/mesa/demos/mesa-demos-8.4.0.tar.gz" \ |
41 |
| - && tar xfv mesa-demos-8.4.0.tar.gz \ |
42 |
| - && rm mesa-demos-8.4.0.tar.gz \ |
43 |
| - && cd mesa-demos-8.4.0 \ |
44 |
| - && ./configure --prefix=/usr/local \ |
45 |
| - && make \ |
46 |
| - && make install \ |
47 |
| - && cd .. \ |
48 |
| - && rm -rf mesa-demos-8.4.0 \ |
49 |
| - && apk del .mesa-demos-build-deps; \ |
50 |
| - fi; \ |
51 |
| - apk del .build-deps; |
| 30 | + git clone https://gitlab.freedesktop.org/mesa/mesa.git; |
| 31 | + |
| 32 | +# Build Mesa from source. |
| 33 | +ARG MESA_VERSION |
| 34 | +RUN set -xe; \ |
| 35 | + cd /var/tmp/build/mesa; \ |
| 36 | + git checkout mesa-${MESA_VERSION}; \ |
| 37 | + libtoolize; \ |
| 38 | + autoreconf --install; \ |
| 39 | + ./configure \ |
| 40 | + --enable-glx=gallium-xlib \ |
| 41 | + --with-gallium-drivers=swrast,swr \ |
| 42 | + --disable-dri \ |
| 43 | + --disable-gbm \ |
| 44 | + --disable-egl \ |
| 45 | + --enable-gallium-osmesa \ |
| 46 | + --enable-autotools \ |
| 47 | + --enable-llvm \ |
| 48 | + --with-llvm-prefix=/usr/lib/llvm7/ \ |
| 49 | + --prefix=/usr/local; \ |
| 50 | + make -j$(getconf _NPROCESSORS_ONLN); \ |
| 51 | + make install; |
52 | 52 |
|
53 | 53 | # Copy our entrypoint into the container.
|
54 | 54 | COPY ./entrypoint.sh /usr/local/bin/entrypoint.sh
|
55 | 55 |
|
| 56 | +# Create fresh image from alpine |
| 57 | +FROM alpine:3.10 |
| 58 | + |
| 59 | +# Install runtime dependencies for Mesa |
| 60 | +RUN set -xe; \ |
| 61 | + apk --update add --no-cache --virtual .runtime-deps \ |
| 62 | + expat \ |
| 63 | + llvm7-libs \ |
| 64 | + xdpyinfo \ |
| 65 | + xvfb; |
| 66 | + |
| 67 | +# Copy the Mesa build & entrypoint script from previous stage |
| 68 | +COPY --from=builder /usr/local /usr/local |
| 69 | + |
| 70 | +# Labels / Metadata. |
| 71 | +ARG VCS_REF |
| 72 | +ARG BUILD_DATE |
| 73 | +ARG MESA_DEMOS |
| 74 | +ARG MESA_VERSION |
| 75 | +LABEL maintainer= "James Brink, [email protected]" \ |
| 76 | + org.label-schema.decription="Mesa3D Software Drivers" \ |
| 77 | + org.label-schema.version="${MESA_VERSION}" \ |
| 78 | + org.label-schema.name="Mesa3D-Software-Drivers" \ |
| 79 | + org.label-schema.build-date="${BUILD_DATE}" \ |
| 80 | + org.label-schema.vcs-ref="${VCS_REF}" \ |
| 81 | + org.label-schema.vcs-url="https://github.com/utensils/docker-opengl" \ |
| 82 | + org.label-schema.schema-version="1.0.0-rc1" |
| 83 | + |
56 | 84 | # Setup our environment variables.
|
57 |
| -ENV XVFB_WHD="1920x1080x24"\ |
58 |
| - DISPLAY=":99" \ |
59 |
| - LIBGL_ALWAYS_SOFTWARE="1" \ |
| 85 | +ENV DISPLAY=":99" \ |
60 | 86 | GALLIUM_DRIVER="llvmpipe" \
|
61 |
| - LP_NO_RAST="false" \ |
| 87 | + LIBGL_ALWAYS_SOFTWARE="1" \ |
62 | 88 | LP_DEBUG="" \
|
| 89 | + LP_NO_RAST="false" \ |
| 90 | + LP_NUM_THREADS="" \ |
63 | 91 | LP_PERF="" \
|
64 |
| - LP_NUM_THREADS="" |
| 92 | + MESA_VERSION="${MESA_VERSION}" \ |
| 93 | + XVFB_WHD="1920x1080x24" |
65 | 94 |
|
66 | 95 | # Set the default command.
|
67 | 96 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
0 commit comments