forked from cvxgrp/scs
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
95 lines (81 loc) · 3.31 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# DOCKER Configuration file
# -------- Licence -------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2017 Pantelis Sopasakis (https://alphaville.github.io),
# Krina Menounou (https://www.linkedin.com/in/krinamenounou),
# Panagiotis Patrinos (http://homes.esat.kuleuven.be/~ppatrino)
# Copyright (c) 2012 Brendan O'Donoghue ([email protected])
# ------------------------------------------------------------------------------
# -------- Instructions --------------------------------------------------------
# Build the docker image by running:
#
# $ docker image build -t kulforbes/superscs:{version-name} .
#
# from within the base directory of this project.
#
#
# Run the docker image and start a terminal to access it by running:
#
# $ docker run -it kulforbes/superscs:{version-name}
#
# To run the latest version, simply run `docker run -it kulforbes/superscs`
#
# Once you access the docker image using a terminal, you may compile the C file
# `superscs_test.c` as follows:
# $ gcc superscs_test.c -o superscs_test -lscsindir -lblas -llapack -lm
# ------------------------------------------------------------------------------
# Build on top of Ubuntu trusty
FROM ubuntu:trusty
# Labels for the SuperSCS docker image
LABEL maintainer="Pantelis Sopasakis <[email protected]>" \
version="v1.3.3" \
license="MIT license" \
description="Fast and accurate conic programming"
# Environment variables
ENV CC=gcc \
SUPERSCS_VERSION="v1.3.3" \
SUPERSCS_INSTALL_DIR="/superscs"
WORKDIR /superscs
# Copy all necessary files
COPY src/ /superscs/src/
COPY include/ /superscs/include/
COPY linsys/ /superscs/linsys/
COPY tests/c/ /superscs/tests/c
COPY scs.mk Makefile LICENSE.txt examples/c/superscs_test.c /superscs/
COPY .motd /etc/
# Install necessary dependencies (blas, lapack, make and gcc)
RUN apt-get update && apt-get -y install \
libblas-dev \
liblapack-dev \
make gcc
# Build, test and install
RUN make \
# run the unit tests
&& make run-test \
# copy library files to /usr/lib/superscs
&& mkdir -p /usr/lib/superscs/ \
&& cp out/libscsdir.a /usr/lib/superscs/ \
&& cp out/libscsindir.a /usr/lib/superscs/ \
&& cp out/libscsdir.so /usr/lib/superscs/ \
&& cp out/libscsindir.so /usr/lib/superscs/ \
# create symbolic links in /usr/lib
&& ln -s /usr/lib/superscs/libscsdir.a /usr/lib/libscsdir.a \
&& ln -s /usr/lib/superscs/libscsindir.a /usr/lib/libscsindir.a \
&& ln -s /usr/lib/superscs/libscsdir.so /usr/lib/libscsdir.so \
&& ln -s /usr/lib/superscs/libscsindir.so /usr/lib/libscsindir.so \
# install header files in /usr/include
# users will have use: #include "superscs/scs.h"
&& cp -r ./include/ /usr/include/superscs \
# copy the header files of linsys in /usr/include/linsys
&& mkdir -p /usr/include/linsys \
&& cp linsys/amatrix.h /usr/include/linsys/ \
&& cp linsys/common.h /usr/include/linsys/ \
# compile the example
&& gcc superscs_test.c -o superscs_run -lscsindir -lblas -llapack -lm \
# make the example runnable (+x)
&& chmod +x /superscs/superscs_run \
# make motd runnable and modify bashrc
&& mv /etc/.motd /etc/motd \
&& chmod +x /etc/motd \
&& echo '/etc/motd' >> /etc/bash.bashrc