Mage Lu Mage Lu commited on
Commit
9da9f1a
·
1 Parent(s): 4d7a211

Add Architecture-Specific Logic for msodbcsql in Dockerfile #4036 (#4049)

Browse files

### What problem does this PR solve?

For the new feature Add mssql support in the Dockerfile, I suggest
including support for msodbcsql18 for ARM64.
Based on current testing results (on macOS ARM64 environment),
msodbcsql18 needs to be installed.
I hope future Dockerfiles can incorporate a conditional check for this.
Specifically:

When $ARCH=arm64 (macOS ARM64 environment), install msodbcsql18.
In other cases (general x86_64 environment), install msodbcsql17.
### Type of change

- [x] New Feature (non-breaking change which adds functionality)

Co-authored-by: Mage Lu <[email protected]>

Files changed (1) hide show
  1. Dockerfile +14 -4
Dockerfile CHANGED
@@ -85,12 +85,22 @@ RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
85
  apt update && \
86
  apt install -y nodejs cargo
87
 
88
- # Add msssql17
 
 
 
89
  RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
90
- curl https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc && \
91
- curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list && \
92
  apt update && \
93
- ACCEPT_EULA=Y apt install -y unixodbc-dev msodbcsql17
 
 
 
 
 
 
 
94
 
95
 
96
 
 
85
  apt update && \
86
  apt install -y nodejs cargo
87
 
88
+
89
+ # Add msssql ODBC driver
90
+ # macOS ARM64 environment, install msodbcsql18.
91
+ # general x86_64 environment, install msodbcsql17.
92
  RUN --mount=type=cache,id=ragflow_apt,target=/var/cache/apt,sharing=locked \
93
+ curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
94
+ curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
95
  apt update && \
96
+ if [ -n "$ARCH" ] && [ "$ARCH" = "arm64" ]; then \
97
+ # MacOS ARM64
98
+ ACCEPT_EULA=Y apt install -y unixodbc-dev msodbcsql18; \
99
+ else \
100
+ # (x86_64)
101
+ ACCEPT_EULA=Y apt install -y unixodbc-dev msodbcsql17; \
102
+ fi || \
103
+ { echo "Failed to install ODBC driver"; exit 1; }
104
 
105
 
106