1
1
ARG PYTHON_VERSION="3.6"
2
2
FROM python:${PYTHON_VERSION}-stretch AS builder
3
3
4
+ SHELL ["/bin/bash" , "-o" , "pipefail" , "-c" ]
5
+
4
6
ARG NODE_VERSION="8.x"
7
+ # hadolint ignore=DL3008
5
8
RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}" | bash - \
6
9
&& apt-get install --no-install-recommends -y \
7
10
nodejs
8
11
12
+ ARG HADOLINT_VERSION=v1.17.1
13
+ RUN curl -fsSL "https://github.com/hadolint/hadolint/releases/download/${HADOLINT_VERSION}/hadolint-Linux-$(uname -m)" -o /usr/local/bin/hadolint \
14
+ && chmod +x /usr/local/bin/hadolint
15
+
9
16
COPY tools/install-mssql.sh /doccano/tools/install-mssql.sh
10
17
RUN /doccano/tools/install-mssql.sh --dev
11
18
12
19
COPY app/server/static/package*.json /doccano/app/server/static/
13
- RUN cd /doccano/app/server/static \
14
- && npm ci
20
+ WORKDIR /doccano/app/server/static
21
+ RUN npm ci
15
22
16
23
COPY requirements.txt /
17
24
RUN pip install -r /requirements.txt \
18
25
&& pip wheel -r /requirements.txt -w /deps
19
26
27
+ COPY Dockerfile /
28
+ RUN hadolint /Dockerfile
29
+
20
30
COPY . /doccano
21
31
22
32
WORKDIR /doccano
23
33
RUN tools/ci.sh
24
34
25
35
FROM builder AS cleaner
26
36
27
- RUN cd /doccano/app/server/static \
28
- && SOURCE_MAP=False DEBUG=False npm run build \
37
+ WORKDIR /doccano/app/server/static
38
+ RUN SOURCE_MAP=False DEBUG=False npm run build \
29
39
&& rm -rf components pages node_modules .*rc package*.json webpack.config.js
30
40
31
- RUN cd /doccano \
32
- && python app/manage.py collectstatic --noinput
41
+ WORKDIR /doccano
42
+ RUN python app/manage.py collectstatic --noinput
33
43
34
44
FROM python:${PYTHON_VERSION}-slim-stretch AS runtime
35
45
@@ -39,6 +49,7 @@ RUN /doccano/tools/install-mssql.sh
39
49
RUN useradd -ms /bin/sh doccano
40
50
41
51
COPY --from=builder /deps /deps
52
+ # hadolint ignore=DL3013
42
53
RUN pip install --no-cache-dir /deps/*.whl
43
54
44
55
COPY --from=cleaner --chown=doccano:doccano /doccano /doccano
0 commit comments