-
Notifications
You must be signed in to change notification settings - Fork 459
Expand file tree
/
Copy pathDockerfile
More file actions
127 lines (101 loc) · 3.68 KB
/
Dockerfile
File metadata and controls
127 lines (101 loc) · 3.68 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
###############################################################################
#----------------------------- BUILD STAGE ------------------------------#
###############################################################################
FROM python:3.6-slim-stretch as builder
ARG CC_VERSION=master
ENV CC_VERSION ${CC_VERSION}
ARG DEBIAN_FRONTEND=noninteractive
RUN set -x && apt-get update -qq \
&& apt-get install -qqy --no-install-recommends \
ca-certificates \
curl \
doxygen \
git \
make \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs
# Download CodeChecker release.
RUN git clone https://github.com/Ericsson/CodeChecker.git /codechecker
WORKDIR /codechecker
RUN git checkout ${CC_VERSION}
# Build CodeChecker web.
RUN make -C /codechecker/web package
###############################################################################
#-------------------------- PRODUCTION STAGE ----------------------------#
###############################################################################
FROM python:3.6-slim-stretch
ARG CC_GID=950
ARG CC_UID=950
ENV CC_GID ${CC_GID}
ENV CC_UID ${CC_UID}
ARG INSTALL_AUTH=yes
ARG INSTALL_PG8000=no
ARG INSTALL_PSYCOPG2=yes
ENV TINI_VERSION v0.18.0
RUN set -x && apt-get update -qq \
# Prevent fail when install postgresql-client.
&& mkdir -p /usr/share/man/man1 \
&& mkdir -p /usr/share/man/man7 \
\
&& apt-get install -qqy --no-install-recommends ca-certificates \
postgresql-client \
# To switch user and exec command.
gosu
RUN if [ "$INSTALL_AUTH" = "yes" ] ; then \
apt-get install -qqy --no-install-recommends \
libldap2-dev \
libsasl2-dev \
libssl-dev; \
fi
RUN if [ "$INSTALL_PSYCOPG2" = "yes" ] ; then \
apt-get install -qqy --no-install-recommends \
libpq-dev; \
fi
COPY --from=builder /codechecker/web/build/CodeChecker /codechecker
# Copy python requirements.
COPY --from=builder /codechecker/web/requirements_py /requirements_py
COPY --from=builder /codechecker/web/requirements.txt /requirements_py
# Copy local API packages (Python, Node).
COPY --from=builder /codechecker/web/api /api
# Install python requirements.
RUN apt-get update -qq && \
apt-get install -qqy --no-install-recommends \
python3-dev \
# gcc is needed to build psutil.
gcc \
\
# Install necessary runtime environment files.
&& pip3 install -r /requirements_py/requirements.txt \
&& if [ "$INSTALL_AUTH" = "yes" ] ; then \
pip3 install -r /requirements_py/auth/requirements.txt; \
fi \
&& if [ "$INSTALL_PG8000" = "yes" ] ; then \
pip3 install -r /requirements_py/db_pg8000/requirements.txt; \
fi \
&& if [ "$INSTALL_PSYCOPG2" = "yes" ] ; then \
pip3 install -r /requirements_py/db_psycopg2/requirements.txt; \
fi \
\
# Remove unnecessary packages.
&& pip3 uninstall -y wheel \
&& apt-get purge -y --auto-remove \
gcc \
python-dev \
\
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/ \
&& set +x
# Create user and group for CodeChecker.
RUN groupadd -r codechecker -g ${CC_GID} \
&& useradd -r --no-log-init -M -u ${CC_UID} -g codechecker codechecker
# Change permission of the CodeChecker package.
RUN chown codechecker:codechecker /codechecker
ENV PATH="/codechecker/bin:$PATH"
COPY ./entrypoint.sh /usr/local/bin/
RUN chmod a+x /usr/local/bin/entrypoint.sh \
&& chown codechecker:codechecker /usr/local/bin/entrypoint.sh
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
EXPOSE 8001
ENTRYPOINT ["/tini", "--", "/usr/local/bin/entrypoint.sh"]
CMD ["CodeChecker", "server", "--workspace", "/workspace", "--not-host-only"]