Skip to content

Commit 51ce26e

Browse files
authored
Merge pull request #122 from dbt-msft/minimize-docker-image
Clean up CI config and Docker image
2 parents 212b9c4 + 9466702 commit 51ce26e

File tree

4 files changed

+52
-88
lines changed

4 files changed

+52
-88
lines changed

.circleci/Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
FROM cimg/python:3.7.10 AS base
3+
USER root
4+
5+
# Setup dependencies for pyodbc
6+
RUN \
7+
apt-get update && \
8+
apt-get install -y unixodbc-dev unixodbc g++ apt-transport-https && \
9+
gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys 5072E1F5
10+
11+
RUN \
12+
export ACCEPT_EULA='Y' && \
13+
# Install pyodbc db drivers for MSSQL
14+
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
15+
curl https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list && \
16+
apt-get update && \
17+
apt-get install -y msodbcsql17 odbc-postgresql mssql-tools
18+
19+
# add sqlcmd to the path
20+
ENV PATH="$PATH:/opt/mssql-tools/bin"
21+
22+
# Update odbcinst.ini to make sure full path to driver is listed
23+
RUN \
24+
sed 's/Driver=psql/Driver=\/usr\/lib\/x86_64-linux-gnu\/odbc\/psql/' /etc/odbcinst.ini > /tmp/temp.ini && \
25+
mv -f /tmp/temp.ini /etc/odbcinst.ini
26+
27+
RUN \
28+
# Cleanup build dependencies
29+
apt-get remove -y curl apt-transport-https debconf-utils rsync build-essential gnupg2 && \
30+
apt-get autoremove -y && apt-get autoclean -y

.circleci/config.yml

Lines changed: 21 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,32 @@
11
version: 2.1
22

33
orbs:
4-
python: circleci/python@1.1.0
4+
python: circleci/python@1.3
55
azure-cli: circleci/[email protected]
66

77
jobs:
88
unit:
9-
docker:
10-
- image: dataders/pyodbc:1.4
9+
docker: &msodbc_py
10+
- image: &docker_image dbtmsft/msodbc_py:0.5
1111
steps:
1212
- checkout
13+
- python/install-packages:
14+
pkg-manager: pip
15+
pip-dependency-file: dev_requirements.txt
1316
- run: tox -- -v test/unit
1417
integration-sqlserver: &sqlserver
15-
docker:
16-
- image: dataders/pyodbc:1.4
18+
docker: &msodbc_py_&_sqlserver
19+
- image: *docker_image
1720
- image: mcr.microsoft.com/mssql/server:2019-latest
1821
environment:
1922
ACCEPT_EULA: 'yes'
2023
MSSQL_SA_PASSWORD: 5atyaNadella
2124
MSSQL_IP_ADDRESS: 0.0.0.0
2225
steps:
23-
- run: &install-git
24-
name: "TEMP: install Git"
25-
command: |
26-
apt-get install -y git
27-
- run: &upgrade-dbt
28-
name: "TEMP: upgrade dbt" # hot fix: dbt is installed in the pyodbc docker image, it should be removed there
29-
command: |
30-
pip install --upgrade dbt
3126
- checkout
27+
- python/install-packages:
28+
pkg-manager: pip
29+
pip-dependency-file: dev_requirements.txt
3230
- run:
3331
name: wait for SQL Server container to set up
3432
command: sleep 30
@@ -41,12 +39,10 @@ jobs:
4139
connection-sqlserver:
4240
<<: *sqlserver
4341
steps:
44-
- run: *install-git
45-
- run: *upgrade-dbt
4642
- checkout
4743
- run: &install-dbt-sqlserver
4844
name: "install dbt-sqlserver"
49-
command: python setup.py install
45+
command: pip install .
5046
- run:
5147
name: wait for SQL Server container to set up
5248
command: sleep 30
@@ -67,32 +63,20 @@ jobs:
6763
dbt compile --target sqlserver_local_encrypt
6864
6965
integration-azuresql:
70-
docker:
71-
- image: dataders/pyodbc:1.4
66+
docker: *msodbc_py
7267
steps:
73-
- run: *install-git
74-
- run: *upgrade-dbt
7568
- checkout
76-
- run: *install-dbt-sqlserver
77-
- run:
78-
name: wake up serverless db
79-
command: |
80-
cd test/integration
81-
dbt debug --target azuresql_sqlcred
69+
- python/install-packages:
70+
pkg-manager: pip
71+
pip-dependency-file: dev_requirements.txt
8272
- run:
8373
name: Test adapter on Azure SQL against dbt-adapter-tests
8474
command: tox -- -v test/integration/azuresql.dbtspec
8575
connection-azuresql:
86-
docker:
87-
- image: dataders/pyodbc:1.4
76+
docker: *msodbc_py
8877
steps:
89-
- run: *install-git
90-
- run: *upgrade-dbt
9178
- checkout
9279
- run: *install-dbt-sqlserver
93-
- run:
94-
name: install gnupg
95-
command: apt-get install gnupg -y
9680
- azure-cli/install
9781
- run: *prep=connect
9882
- run:
@@ -124,13 +108,9 @@ workflows:
124108
main:
125109
jobs:
126110
- unit
127-
- connection-azuresql:
128-
context:
129-
- DBT_SYNAPSE_PROFILE
130-
- connection-sqlserver:
131-
context:
132-
- DBT_SYNAPSE_PROFILE
133-
- integration-sqlserver
134-
- integration-azuresql:
111+
- connection-azuresql: &profile
135112
context:
136113
- DBT_SYNAPSE_PROFILE
114+
- connection-sqlserver: *profile
115+
- integration-sqlserver: *profile
116+
- integration-azuresql: *profile

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#### under the hood
1515
- dbt-sqlserver's incremental materialization is now 100% aligneed logically to dbt's global_project behavior! this makes maintaining `dbt-sqlserver` easier by decreasing code footprint. [#102](https://github.com/dbt-msft/dbt-sqlserver/pull/102)
16+
- clean up CI config and corresponding Docker image [#122](https://github.com/dbt-msft/dbt-sqlserver/pull/122)
1617

1718
### v0.19.0
1819

pyodbc.Dockerfile

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)