61 lines
2.1 KiB
Docker
61 lines
2.1 KiB
Docker
## Based on https://github.com/ocaml/opam-dockerfiles
|
|
|
|
FROM alpine:$alpine_version
|
|
|
|
RUN apk update && apk upgrade && \
|
|
apk add build-base snappy-dev abuild alpine-sdk \
|
|
openssh bash nano ncurses-dev rsync xz m4 \
|
|
ocaml \
|
|
gmp-dev libev-dev libressl-dev linux-headers pcre-dev perl zlib-dev \
|
|
libsodium-dev && \
|
|
rm -f /var/cache/apk/* && \
|
|
adduser -S opam && \
|
|
adduser opam abuild && \
|
|
echo 'opam ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/opam && \
|
|
chmod 440 /etc/sudoers.d/opam && \
|
|
chown root:root /etc/sudoers.d/opam && \
|
|
sed -i.bak 's/^Defaults.*requiretty//g' /etc/sudoers
|
|
|
|
USER opam
|
|
|
|
WORKDIR /home/opam
|
|
|
|
RUN mkdir ~/.ssh && \
|
|
chmod 700 ~/.ssh && \
|
|
git config --global user.email "docker@example.com" && \
|
|
git config --global user.name "Docker CI" && \
|
|
cd /home/opam && \
|
|
git clone -b "$opam_tag" git://github.com/ocaml/opam && \
|
|
cd /home/opam/opam && \
|
|
./configure --prefix /usr && \
|
|
make lib-ext && \
|
|
make opam && \
|
|
sudo cp -L opam /usr/bin/opam && \
|
|
cd /home/opam && \
|
|
sudo -u opam sh -c "git clone -b master git://github.com/ocaml/opam-repository" && \
|
|
cd opam-repository && \
|
|
sudo -u opam sh -c "cd /home/opam/opam-repository && opam admin upgrade && git checkout -b v2 && git add . && git commit -a -m 'opam admin upgrade'" && \
|
|
sudo -u opam sh -c "opam init -a -y --comp $ocaml_version /home/opam/opam-repository" && \
|
|
sudo -u opam sh -c "opam install -y depext travis-opam" && \
|
|
cd /home/opam/opam && \
|
|
make opam-installer && \
|
|
sudo cp -L opam-installer /usr/bin/opam-installer && \
|
|
rm -r /home/opam/opam
|
|
|
|
COPY scripts/leveldb-1.18.APKBUILD /home/opam/leveldb-1.18/APKBUILD
|
|
RUN sudo chown -R opam leveldb-1.18
|
|
|
|
RUN sudo apk update && \
|
|
abuild-keygen -ai && \
|
|
cd leveldb-1.18 && \
|
|
abuild checksum && abuild -r && \
|
|
cd .. && \
|
|
sudo apk add packages/opam/x86_64/leveldb-1.18-r0.apk && \
|
|
sudo apk add packages/opam/x86_64/leveldb-dev-1.18-r0.apk && \
|
|
rm -rf leveldb-1.18 packages && \
|
|
sudo rm -f /var/cache/apk/*
|
|
|
|
ENTRYPOINT [ "opam", "config", "exec", "--" ]
|
|
|
|
CMD [ "sh" ]
|