-
Notifications
You must be signed in to change notification settings - Fork 117
/
Dockerfile
56 lines (41 loc) · 1.46 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
ARG BASE=ubuntu:20.04
ARG PROJECT_NAME=cmake-init
ARG WORKSPACE=/workspace
# BUILD
FROM $BASE AS cmake-init-build
ARG PROJECT_NAME
ARG WORKSPACE
ARG COMPILER_FLAGS="-j 4"
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y --no-install-recommends sudo \
&& echo 'user ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/user
RUN apt install -y --no-install-recommends cmake git build-essential
ENV PROJECT_DIR="$WORKSPACE/$PROJECT_NAME"
WORKDIR $WORKSPACE
ADD cmake $PROJECT_NAME/cmake
ADD docs $PROJECT_NAME/docs
ADD data $PROJECT_NAME/data
ADD deploy $PROJECT_NAME/deploy
ADD source $PROJECT_NAME/source
ADD CMakeLists.txt $PROJECT_NAME/CMakeLists.txt
ADD configure $PROJECT_NAME/configure
ADD template-config.cmake $PROJECT_NAME/template-config.cmake
ADD $PROJECT_NAME-logo.png $PROJECT_NAME/$PROJECT_NAME-logo.png
ADD $PROJECT_NAME-logo.svg $PROJECT_NAME/$PROJECT_NAME-logo.svg
ADD LICENSE $PROJECT_NAME/LICENSE
ADD README.md $PROJECT_NAME/README.md
ADD AUTHORS $PROJECT_NAME/AUTHORS
WORKDIR $PROJECT_DIR
RUN ./configure
RUN CMAKE_OPTIONS="-DOPTION_BUILD_TESTS=Off -DCMAKE_INSTALL_PREFIX=$WORKSPACE/$PROJECT_NAME-install" ./configure
RUN cmake --build build -- $COMPILER_FLAGS
RUN cmake --build build --target install
# DEPLOY
FROM $BASE AS cmake-init
ARG PROJECT_NAME
ARG WORKSPACE
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install -y --no-install-recommends cmake
COPY --from=cmake-init-build $WORKSPACE/$PROJECT_NAME-install $WORKSPACE/$PROJECT_NAME