Dockerfile (2956B)
1 FROM $DOCKER_IMAGE_PARENT 2 MAINTAINER Gabriele Svelto <gsvelto@mozilla.com> 3 4 RUN mkdir -p /builds 5 RUN id worker || useradd -d /builds/worker -s /bin/bash -m worker 6 WORKDIR /builds/worker 7 8 # We need to declare all potentially cache volumes as caches. Also, 9 # making high I/O paths volumes increase I/O throughput because of 10 # AUFS slowness. 11 VOLUME /builds/worker/checkouts 12 13 ARG EXTRA_PACKAGES 14 15 RUN apt-get update && \ 16 apt-get install -y \ 17 build-essential \ 18 curl \ 19 $EXTRA_PACKAGES \ 20 gnupg \ 21 jq \ 22 patch \ 23 patchelf \ 24 python3-dev \ 25 python3-yaml \ 26 squashfs-tools \ 27 tar \ 28 unzip \ 29 uuid \ 30 wget \ 31 zip 32 33 ARG SNAP_BASE 34 35 COPY install-snap.sh /usr/local/bin/ 36 37 RUN install-snap.sh core 38 39 # 8.11.1 is https://api.snapcraft.io/api/v1/snaps/download/vMTKRaLjnOJQetI78HjntT37VuoyssFE_15600.snap 40 RUN install-snap.sh snapcraft 41 42 RUN install-snap.sh $SNAP_BASE 43 44 ARG SNAP_LIST 45 46 RUN for snap in $SNAP_LIST; do install-snap.sh "${snap}"; done 47 48 # Create a snapcraft runner 49 RUN mkdir -p /snap/bin 50 RUN echo "#!/bin/sh" > /snap/bin/snapcraft 51 RUN snap_version="$(awk '/^version:/{print $2}' /snap/snapcraft/current/meta/snap.yaml)" && echo "export SNAP_VERSION=\"$snap_version\"\nexport PATH=\$SNAP/bin/:\$SNAP/libexec/snapcraft/:\$PATH" >> /snap/bin/snapcraft 52 RUN echo 'exec "$SNAP/bin/snapcraft" "$@"' >> /snap/bin/snapcraft 53 RUN chmod +x /snap/bin/snapcraft 54 55 # Generate locale 56 RUN apt update && apt dist-upgrade --yes && apt install --yes sudo snapd locales && locale-gen en_US.UTF-8 && apt-get autoremove -y 57 58 # Set the proper environment 59 ENV LANG="en_US.UTF-8" 60 ENV LANGUAGE="en_US:en" 61 ENV LC_ALL="en_US.UTF-8" 62 ENV PATH="/snap/bin:$PATH" 63 ENV SNAP="/snap/snapcraft/current" 64 ENV SNAP_NAME="snapcraft" 65 ENV SNAP_ARCH="amd64" 66 ENV SNAP_INSTANCE_KEY= 67 ENV SNAP_INSTANCE_NAME=snapcraft 68 ENV SNAPCRAFT_PLATFORM= 69 70 # Bug 1985494 71 # 72 # The change at https://github.com/canonical/craft-application/commit/f3436a9eab1eeed3ad6d44d9d430b5f4b008f7d8 73 # moved configuration query and breaks us in docker 74 # This is a temporary workaround and proper fix should be done: 75 # - either there's a way to feed the configuration to avoid hitting snapctl 76 # - or we need to introduce a way to bypass that properly with upstream 77 RUN sed -ri 's/debug_mode = .*/debug_mode = False/g' /snap/snapcraft/current/lib/python*/site-packages/craft_application/application.py 78 RUN snapcraft --version 79 80 # Snapcraft pull will need to sudo apt-get update ... 81 RUN echo "worker ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/worker && \ 82 chmod 0440 /etc/sudoers.d/worker 83 84 COPY system-setup.sh /builds/worker/system-setup.sh 85 86 RUN /builds/worker/system-setup.sh "${SNAP_BASE}" 87 88 COPY run.sh /builds/worker/run.sh 89 90 COPY parse.py /builds/worker/parse.py 91 92 COPY patches /builds/worker/patches/ 93 94 RUN chown -R worker:worker /builds/worker 95 96 # Set a default command useful for debugging 97 CMD ["/bin/bash", "--login"]