File tree Expand file tree Collapse file tree 3 files changed +49
-15
lines changed Expand file tree Collapse file tree 3 files changed +49
-15
lines changed Original file line number Diff line number Diff line change 6
6
env :
7
7
- DATABASE=sqlite
8
8
- DATABASE=postgres
9
+ - DATABASE=mssql
9
10
10
11
services :
11
12
- docker
@@ -16,6 +17,11 @@ before_install:
16
17
if [[ "${DATABASE}" = "postgres" ]]; then
17
18
docker run --rm --name=postgres --network=doccano -d -e POSTGRES_USER=user -e POSTGRES_PASSWORD=pass -e POSTGRES_DB=db postgres
18
19
export DATABASE_URL="postgres://user:pass@postgres:5432/db?sslmode=disable"
20
+
21
+ elif [[ "${DATABASE}" = "mssql" ]]; then
22
+ docker run --rm --name=mssql --network=doccano -d -e ACCEPT_EULA=y -e SA_PASSWORD=sUp3rS3cr3t mcr.microsoft.com/mssql/server:2017-latest
23
+ docker exec -it mssql sh -c "while ! /opt/mssql-tools/bin/sqlcmd -U SA -P sUp3rS3cr3t -Q 'CREATE DATABASE db;'; do sleep 3; done"
24
+ export DATABASE_URL="mssql://SA:sUp3rS3cr3t@mssql:1433/db?sslmode=disable"
19
25
fi
20
26
21
27
install :
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ RUN curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}" | bash - \
6
6
&& apt-get install --no-install-recommends -y \
7
7
nodejs=8.16.0-1nodesource1
8
8
9
- RUN apt-get install --no-install-recommends -y \
10
- unixodbc-dev=2.3.4-1
9
+ COPY tools/install-mssql.sh /doccano/tools/ install-mssql.sh
10
+ RUN /doccano/tools/install-mssql.sh --dev
11
11
12
12
COPY app/server/static/package*.json /doccano/app/server/static/
13
13
RUN cd /doccano/app/server/static \
@@ -33,19 +33,8 @@ RUN cd /doccano \
33
33
34
34
FROM python:${PYTHON_VERSION}-slim-stretch AS runtime
35
35
36
- RUN apt-get update \
37
- && apt-get install --no-install-recommends -y \
38
- curl=7.52.1-5+deb9u9 \
39
- gnupg=2.1.18-8~deb9u4 \
40
- apt-transport-https=1.4.9 \
41
- && curl -fsS https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
42
- && curl -fsS https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql.list \
43
- && apt-get update \
44
- && ACCEPT_EULA=Y apt-get install --no-install-recommends -y \
45
- msodbcsql17=17.3.1.1-1 \
46
- mssql-tools=17.3.0.1-1 \
47
- && apt-get remove -y curl gnupg apt-transport-https \
48
- && rm -rf /var/lib/apt/lists/*
36
+ COPY --from=builder /doccano/tools/install-mssql.sh /doccano/tools/install-mssql.sh
37
+ RUN /doccano/tools/install-mssql.sh
49
38
50
39
RUN useradd -ms /bin/sh doccano
51
40
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # parse arguments
4
+ mode=" prod"
5
+ for opt in " $@ " ; do
6
+ case " ${opt} " in
7
+ --dev) mode=" dev" ;;
8
+ esac
9
+ done
10
+
11
+ set -eo pipefail
12
+
13
+ # install build dependencies
14
+ apt-get update
15
+ apt-get install --no-install-recommends -y \
16
+ curl=7.52.1-5+deb9u9 \
17
+ gnupg=2.1.18-8~deb9u4 \
18
+ apt-transport-https=1.4.9
19
+
20
+ # install dependency to compile django-pyodbc-azure
21
+ if [[ " ${mode} " = " dev" ]]; then
22
+ apt-get install --no-install-recommends -y \
23
+ unixodbc-dev=2.3.4-1
24
+ fi
25
+
26
+ # add mssql repo
27
+ curl -fsS https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
28
+ curl -fsS https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql.list
29
+ apt-get update
30
+
31
+ # install mssql
32
+ ACCEPT_EULA=Y apt-get install --no-install-recommends -y \
33
+ msodbcsql17=17.3.1.1-1 \
34
+ mssql-tools=17.3.0.1-1
35
+
36
+ # remove build dependencies and artifacts
37
+ apt-get remove -y \
38
+ curl gnupg apt-transport-https
39
+ rm -rf /var/lib/apt/lists/*
You can’t perform that action at this time.
0 commit comments