-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile.ubuntu
106 lines (93 loc) · 3.64 KB
/
Dockerfile.ubuntu
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
96
97
98
99
100
101
102
103
104
105
106
ARG RUBY_PATH=/usr/local/
ARG RUBY_VERSION=3.1.4
FROM ubuntu:20.04 AS rubybuild
ARG RUBY_PATH
ARG RUBY_VERSION
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
git \
curl \
autoconf \
bison \
build-essential \
libssl-dev \
libyaml-dev \
libreadline6-dev \
zlib1g-dev \
libncurses5-dev \
libffi-dev \
libgdbm6 \
libgdbm-dev \
snapd && \
git clone https://github.com/rbenv/ruby-build.git $RUBY_PATH/plugins/ruby-build && \
$RUBY_PATH/plugins/ruby-build/install.sh && \
ruby-build $RUBY_VERSION $RUBY_PATH && \
rm -rf ~/.rbenv/cache && \
apt-get clean && rm -rf /var/lib/apt/lists/*
FROM ubuntu:20.04
USER root
LABEL maintainer="[email protected]"
ARG RUBY_PATH
ARG METANORMA_IMAGE_NAME=metanorma
ENV PATH $RUBY_PATH/bin:$PATH
COPY --from=rubybuild $RUBY_PATH $RUBY_PATH
ENV DEBIAN_FRONTEND=noninteractive
ENV CONTAINER_TIMEZONE=Etc/UTC
RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && \
echo $CONTAINER_TIMEZONE > /etc/timezone
# install dependencies
RUN apt-get update && \
apt-get --no-install-recommends install -y curl git make sassc && \
apt-get update && curl -L "https://raw.githubusercontent.com/metanorma/plantuml-install/main/ubuntu.sh" | bash && \
apt-get purge -y default-jre && \
apt-get autoremove -y && \
apt-get --no-install-recommends install -y openjdk-8-jre software-properties-common && \
add-apt-repository ppa:inkscape.dev/stable && \
apt-get --no-install-recommends install -y inkscape && \
rm -rf /usr/share/inkscape/tutorials && \
apt-get --no-install-recommends install -y python3-pip python3-setuptools python3-wheel python3-lxml && \
pip3 install --no-cache-dir idnits xml2rfc --ignore-installed six chardet && rm -rf /root/.cache/pip && \
apt-get purge -y python3-pip python3-setuptools python3-wheel && \
apt-get autoremove -y && apt-get clean && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# From https://github.com/docker-library/ruby/blob/master/
# Dockerfile-debian.template
# don't create ".bundle" in all our apps
ENV GEM_HOME /usr/local/bundle
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME" \
BUNDLE_WITHOUT="development:test"
ENV PATH $GEM_HOME/bin:$PATH
# adjust permissions of a few directories for running "gem install" as an arbitrary user
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
# End From
# install metanorma toolchain
RUN mkdir -p /setup
COPY $METANORMA_IMAGE_NAME/Gemfile /setup/Gemfile
RUN --mount=type=secret,id=bundle_config,dst=$GEM_HOME/config \
--mount=type=secret,id=gemrc_config,dst=$GEM_HOME/.gemrc \
gem install bundler && \
apt-get update && \
apt-get --no-install-recommends install -y make gcc g++ ruby-dev cmake libxml2-dev libxslt-dev libsass-dev zlib1g-dev libyaml-dev && \
cd /setup && \
bundle install --no-cache --verbose && \
rm -rf /usr/local/bundle/cache && \
find /usr/local/bundle/gems -type d -name 'spec' -prune -exec rm -r "{}" \; && \
find /usr/local/bundle/gems -type d -name 'test' -prune -exec rm -r "{}" \; && \
apt-get purge -y make gcc g++ ruby-dev cmake libxml2-dev libxslt-dev libsass-dev zlib1g-dev libyaml-dev && \
apt-get autoremove -y && apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN fontist update
# export java executable path
ENV JAVA_HOME /usr/lib/jvm/default-java
ENV PATH $PATH:$JAVA_HOME/bin
ENV RUBYOPT -rbundler/setup
ENV BUNDLE_GEMFILE /setup/Gemfile
# Workaround for https://github.com/relaton/relaton/issues/99
ENV RELATON_FETCH_PARALLEL 1
ENV FONTIST_PATH "/config"
VOLUME /config/fonts
WORKDIR /metanorma
CMD metanorma