-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
57 lines (50 loc) · 1.77 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# each statement makes a new layer
# set base image (host OS)
FROM python:3
LABEL stage=builder
# set the working directory in the container
WORKDIR /code
# copy the dependencies file to the working directory
COPY requirements.txt .
# install dependencies
RUN pip install -U pip && pip install -r requirements.txt
# copy the content of the local directory to the working directory
COPY . .
# set ipython environment variable
ENV IPYTHONDIR=/code/.ipython
# create an Ipython profile to manage default imports
RUN ipython profile create template && \
echo "c.InteractiveShellApp.exec_lines = \
['import jsonutils as js', \
'from jsonutils.base import JSONObject, \
JSONDict, \
JSONList, \
JSONStr, \
JSONFloat, \
JSONInt, \
JSONNull, \
JSONBool, \
JSONUnknown', \
'from jsonutils.exceptions import *', \
'from jsonutils.query import I, SingleQuery, All, ExtractYear', \
'from jsonutils.functions.parsers import parse_float, \
parse_datetime, parse_bool, parse_json, url_validator, \
parse_int, parse_timestamp', \
'from jsonutils.functions.dummy import dummy_json', \
'from jsonutils.functions.decorators import global_config', \
'from jsonutils.functions.seekers import DefaultDict, DefaultList', \
'from datetime import date, datetime', \
'import pytz', \
'import json', \
'import re', \
'import os', \
'from pathlib import Path', \
'import requests', \
'import pandas as pd', \
'import numpy as np', \
'from bs4 import BeautifulSoup', \
'from unicodedata import normalize', \
'test = JSONObject.open(\'jsonutils/tests/json-schema-test.json\')' \
]" >> /code/.ipython/profile_template/ipython_config.py
# command to run on container start
CMD [ "ipython", "--profile=template" ]