Skip to content

Commit

Permalink
Use service account to access BQ
Browse files Browse the repository at this point in the history
  • Loading branch information
inglesp committed Dec 5, 2023
1 parent 3404537 commit 3e39f3a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Credentials for accessing BigQuery
bq-service-account.json

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -17,4 +20,4 @@ __pycache__/
.DS_Store

# Emacs
*~
*~
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM ebmdatalab/datalab-jupyter:python3.8.1-2328e31e7391a127fe7184dcce38d581a17b
# Set up jupyter environment
ENV MAIN_PATH=/home/app/notebook

# Set path to BQ service account credentials
ENV EBMDATALAB_BQ_CREDENTIALS_PATH=/tmp/bq-service-account.json

# Install pip requirements
COPY requirements.txt /tmp/
# Hack until this is fixed https://github.com/jazzband/pip-tools/issues/823
Expand All @@ -18,3 +21,7 @@ COPY config/kernel.json /tmp/kernel_with_custom_path/kernel.json
RUN jupyter kernelspec install /tmp/kernel_with_custom_path/ --user --name="python3"

CMD cd ${MAIN_PATH} && PYTHONPATH=${MAIN_PATH} jupyter lab --config=config/jupyter_notebook_config.py

# Copy BQ service account credentials into container
# We work around the credentials not existing in CI with the glob
COPY bq-service-account.jso[n] /tmp/
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ cycler==0.10.0 # via matplotlib
decorator==4.4.1 # via ipython, traitlets
defusedxml==0.6.0 # via nbconvert
descartes==1.1.0 # via ebmdatalab
ebmdatalab==0.0.25 # via -r requirements.in
ebmdatalab==0.0.29 # via -r requirements.in
entrypoints==0.3 # via nbconvert
fiona==1.8.13 # via geopandas
geopandas==0.6.3 # via ebmdatalab
Expand Down

0 comments on commit 3e39f3a

Please sign in to comment.