Merge branch 'feature/#1-dockerfile-with-installation-script' into 'master'
Add a Dockerfile, installer.sh and ligo.sh for easy ligo usage with Docker Closes #1 See merge request ligolang/ligo!1
This commit is contained in:
commit
8f83e4f97b
@ -1,32 +1,33 @@
|
|||||||
variables:
|
variables:
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
before_script:
|
.before_script: &before_script
|
||||||
|
before_script:
|
||||||
|
# Install dependencies
|
||||||
|
# rsync is needed by opam to sync a package installed from a local directory with the copy in ~/.opam
|
||||||
|
- apt-get update -qq
|
||||||
|
- apt-get -y -qq install rsync libhidapi-dev libcap-dev libev-dev bubblewrap
|
||||||
|
- wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O opam-2.0.1-x86_64-linux
|
||||||
|
- cp opam-2.0.1-x86_64-linux /usr/local/bin/opam
|
||||||
|
- chmod +x /usr/local/bin/opam
|
||||||
|
- export PATH="/usr/local/bin${PATH:+:}${PATH:-}"
|
||||||
|
|
||||||
# Install dependencies
|
# Initialise opam
|
||||||
# rsync is needed by opam to sync a package installed from a local directory with the copy in ~/.opam
|
- printf '' | opam init --bare
|
||||||
- apt-get update -qq
|
- eval $(opam config env)
|
||||||
- apt-get -y -qq install rsync libhidapi-dev libcap-dev libev-dev bubblewrap
|
|
||||||
- wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O opam-2.0.1-x86_64-linux
|
|
||||||
- cp opam-2.0.1-x86_64-linux /usr/local/bin/opam
|
|
||||||
- chmod +x /usr/local/bin/opam
|
|
||||||
- export PATH="/usr/local/bin${PATH:+:}${PATH:-}"
|
|
||||||
|
|
||||||
# Initialise opam
|
# Create switch
|
||||||
- printf '' | opam init --bare
|
- printf '' | opam switch create toto ocaml-base-compiler.4.06.1
|
||||||
- eval $(opam config env)
|
- eval $(opam config env)
|
||||||
|
|
||||||
# Create switch
|
# Show versions and current switch
|
||||||
- printf '' | opam switch create toto ocaml-base-compiler.4.06.1
|
- echo "$PATH"
|
||||||
- eval $(opam config env)
|
- opam --version
|
||||||
|
- printf '' | ocaml
|
||||||
# Show versions and current switch
|
- opam switch
|
||||||
- echo "$PATH"
|
|
||||||
- opam --version
|
|
||||||
- printf '' | ocaml
|
|
||||||
- opam switch
|
|
||||||
|
|
||||||
local-dune-job:
|
local-dune-job:
|
||||||
|
<<: *before_script
|
||||||
script:
|
script:
|
||||||
- vendors/ligo-opam-repository/rewrite-local-opam-repository.sh
|
- vendors/ligo-opam-repository/rewrite-local-opam-repository.sh
|
||||||
- opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local/"
|
- opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local/"
|
||||||
@ -40,6 +41,7 @@ local-dune-job:
|
|||||||
# - src/ligo/bin/cli.ml
|
# - src/ligo/bin/cli.ml
|
||||||
|
|
||||||
local-repo-job:
|
local-repo-job:
|
||||||
|
<<: *before_script
|
||||||
script:
|
script:
|
||||||
- vendors/ligo-opam-repository/rewrite-local-opam-repository.sh
|
- vendors/ligo-opam-repository/rewrite-local-opam-repository.sh
|
||||||
- opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local/"
|
- opam repository add localrepo "file://$PWD/vendors/ligo-opam-repository-local/"
|
||||||
@ -47,6 +49,7 @@ local-repo-job:
|
|||||||
- opam install -y ligo
|
- opam install -y ligo
|
||||||
|
|
||||||
remote-repo-job:
|
remote-repo-job:
|
||||||
|
<<: *before_script
|
||||||
script:
|
script:
|
||||||
# Add repository
|
# Add repository
|
||||||
- opam repository add ligo-repository https://gitlab.com/ligolang/ligo-opam-repository.git
|
- opam repository add ligo-repository https://gitlab.com/ligolang/ligo-opam-repository.git
|
||||||
@ -57,3 +60,10 @@ remote-repo-job:
|
|||||||
#- opam install -y merlin
|
#- opam install -y merlin
|
||||||
#- opam install -y ocp-indent
|
#- opam install -y ocp-indent
|
||||||
#- opam user-setup install
|
#- opam user-setup install
|
||||||
|
|
||||||
|
build-docker-image:
|
||||||
|
image: docker:1.11
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
script:
|
||||||
|
- docker build -t marigold/ligo ./docker
|
31
docker/Dockerfile
Normal file
31
docker/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# We could use one of the nomadiclab's docker images as a base instead
|
||||||
|
# We're using 4.06 instead of 4.06.1, if this causes problems built a custom 4.06.1 image instead
|
||||||
|
FROM ocaml/opam2:4.06
|
||||||
|
|
||||||
|
USER root
|
||||||
|
|
||||||
|
# Setup a custom opam repository where ligo is published
|
||||||
|
RUN git clone https://gitlab.com/gabriel.alfour/ligo-opam-repository
|
||||||
|
RUN opam repo add ligo-opam-repository ./ligo-opam-repository
|
||||||
|
RUN opam update ligo-opam-repository
|
||||||
|
|
||||||
|
# Install required native dependencies
|
||||||
|
RUN apt-get -y install \
|
||||||
|
libev-dev \
|
||||||
|
perl \
|
||||||
|
pkg-config \
|
||||||
|
libgmp-dev \
|
||||||
|
libhidapi-dev \
|
||||||
|
m4
|
||||||
|
|
||||||
|
# Install ligo
|
||||||
|
RUN git clone https://gitlab.com/gabriel.alfour/ligo
|
||||||
|
RUN opam update
|
||||||
|
|
||||||
|
RUN cd ligo/src && \
|
||||||
|
opam install . --yes
|
||||||
|
|
||||||
|
RUN eval $(opam env)
|
||||||
|
|
||||||
|
# Use the ligo binary as a default command
|
||||||
|
ENTRYPOINT [ "/home/opam/.opam/4.06/bin/ligo" ]
|
16
docker/installer.sh
Normal file
16
docker/installer.sh
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# You can run this installer like this:
|
||||||
|
# curl https://gitlab.com/gabriel.alfour/ligo/blob/master/docker/installer.sh | bash
|
||||||
|
# Make sure the marigold/ligo image is published at docker hub first
|
||||||
|
echo "Installing LIGO"
|
||||||
|
|
||||||
|
# Install the ligo.sh from master
|
||||||
|
wget https://gitlab.com/gabriel.alfour/ligo/blob/master/docker/ligo.sh
|
||||||
|
|
||||||
|
# Copy the exucutable to the appropriate directory
|
||||||
|
sudo cp ligo.sh /usr/local/bin/ligo
|
||||||
|
sudo chmod +x /usr/local/bin/ligo
|
||||||
|
rm ligo.sh
|
||||||
|
|
||||||
|
# Installation finished, try running 'ligo' from your CLI
|
||||||
|
echo "Installation successfull, try running 'ligo' now. \n"
|
2
docker/ligo.sh
Normal file
2
docker/ligo.sh
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
docker run -it -v $PWD:$PWD -w $PWD marigold/ligo $@
|
Loading…
Reference in New Issue
Block a user