2020-06-07 10:01:42 +00:00
|
|
|
# install the latest Alpine linux from scratch
|
|
|
|
|
|
|
|
FROM scratch
|
2021-12-07 16:13:02 +00:00
|
|
|
ARG ALPINE_VERSION=3.15.0
|
2020-12-27 20:28:52 +00:00
|
|
|
ARG ALPINE_ARCH=x86_64
|
|
|
|
ADD alpine-minirootfs-${ALPINE_VERSION}-${ALPINE_ARCH}.tar.gz /
|
2020-06-07 10:01:42 +00:00
|
|
|
|
|
|
|
# the following is adapted from https://github.com/NixOS/docker/blob/master/Dockerfile
|
|
|
|
|
|
|
|
# Enable HTTPS support in wget and set nsswitch.conf to make resolution work within containers
|
|
|
|
RUN apk add --no-cache --update openssl \
|
2021-07-06 10:47:51 +00:00
|
|
|
&& echo hosts: files dns > /etc/nsswitch.conf
|
2020-06-07 10:01:42 +00:00
|
|
|
|
|
|
|
# Download Nix and install it into the system.
|
2021-12-07 16:13:02 +00:00
|
|
|
ARG NIX_VERSION=2.4
|
2020-12-27 20:28:52 +00:00
|
|
|
RUN wget https://nixos.org/releases/nix/nix-${NIX_VERSION}/nix-${NIX_VERSION}-${ALPINE_ARCH}-linux.tar.xz \
|
|
|
|
&& tar xf nix-${NIX_VERSION}-${ALPINE_ARCH}-linux.tar.xz \
|
2020-06-07 10:01:42 +00:00
|
|
|
&& addgroup -g 30000 -S nixbld \
|
|
|
|
&& for i in $(seq 1 30); do adduser -S -D -h /var/empty -g "Nix build user $i" -u $((30000 + i)) -G nixbld nixbld$i ; done \
|
|
|
|
&& mkdir -m 0755 /etc/nix \
|
|
|
|
&& echo 'sandbox = false' > /etc/nix/nix.conf \
|
2020-12-27 20:28:52 +00:00
|
|
|
&& mkdir -m 0755 /nix && USER=root sh nix-${NIX_VERSION}-${ALPINE_ARCH}-linux/install \
|
2020-06-07 10:01:42 +00:00
|
|
|
&& ln -s /nix/var/nix/profiles/default/etc/profile.d/nix.sh /etc/profile.d/ \
|
2020-12-27 20:28:52 +00:00
|
|
|
&& rm -r /nix-${NIX_VERSION}-${ALPINE_ARCH}-linux* \
|
2020-06-07 10:01:42 +00:00
|
|
|
&& rm -rf /var/cache/apk/* \
|
|
|
|
&& /nix/var/nix/profiles/default/bin/nix-collect-garbage --delete-old \
|
|
|
|
&& /nix/var/nix/profiles/default/bin/nix-store --optimise \
|
|
|
|
&& /nix/var/nix/profiles/default/bin/nix-store --verify --check-contents
|
|
|
|
|
|
|
|
ENV \
|
|
|
|
USER=root \
|
|
|
|
PATH=/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin \
|
|
|
|
GIT_SSL_CAINFO=/etc/ssl/certs/ca-certificates.crt \
|
|
|
|
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt \
|
|
|
|
NIX_PATH=/nix/var/nix/profiles/per-user/root/channels
|
|
|
|
|
|
|
|
# Trezor specific stuff starts here
|
2017-11-04 00:56:05 +00:00
|
|
|
|
2020-05-03 17:00:57 +00:00
|
|
|
COPY shell.nix shell.nix
|
2022-01-09 09:09:11 +00:00
|
|
|
COPY pyright/ pyright/
|
2017-11-04 00:56:05 +00:00
|
|
|
|
2020-10-12 20:03:18 +00:00
|
|
|
# to make multiple python versions and monero test suite available, run docker build
|
2020-05-03 17:00:57 +00:00
|
|
|
# with the following argument: "--build-arg FULLDEPS_TESTING=1"
|
|
|
|
ARG FULLDEPS_TESTING=0
|
|
|
|
ENV FULLDEPS_TESTING=${FULLDEPS_TESTING}
|
2019-08-13 13:39:58 +00:00
|
|
|
|
2020-10-12 20:03:18 +00:00
|
|
|
RUN nix-shell --arg fullDeps "$([ ${FULLDEPS_TESTING} = 1 ] && echo true || echo false)" --run "echo deps pre-installed"
|
2019-08-13 09:20:18 +00:00
|
|
|
|
2020-10-12 20:03:18 +00:00
|
|
|
CMD [ "nix-shell" ]
|