1
+ # FROM stackql/stackql:latest AS stackql
2
+ # EXPOSE 5444
3
+ # WORKDIR /home/stackql
4
+ # RUN adduser --system --uid 1001 stackql
5
+ # RUN addgroup --system --gid 1001 stackql
6
+ # RUN chown stackql:stackql /home/stackql
7
+ # RUN chown stackql:stackql /srv
8
+ # USER stackql
9
+ # # pull stackql providers
10
+ # RUN stackql exec 'registry pull aws' || (echo "Failed to pull aws provider" && exit 1)
11
+ # RUN stackql exec 'registry pull google' || (echo "Failed to pull google provider" && exit 1)
12
+ # RUN stackql exec 'registry pull github' || (echo "Failed to pull github provider" && exit 1)
13
+ # RUN stackql exec 'registry pull azure' || (echo "Failed to pull azure provider" && exit 1)
14
+ # # RUN stackql exec 'registry pull k8s'
15
+ # # RUN stackql exec 'registry pull netlify'
16
+ # # RUN stackql exec 'registry pull okta'
17
+ # # RUN stackql exec 'registry pull sumologic'
18
+ # # RUN stackql exec 'registry pull digitalocean'
19
+
20
+ # FROM jupyter/base-notebook:latest AS jupyter
21
+ # WORKDIR /jupyter
22
+ # USER root
23
+ # RUN apt-get update && \
24
+ # apt-get upgrade -y
25
+ # # copy example notebooks to Jupyter workspace
26
+ # COPY ./notebooks/ /jupyter/
27
+ # RUN chmod 644 *.ipynb && \
28
+ # chown jovyan:users *.ipynb
29
+ # # copy magic extensions
30
+ # RUN mkdir -p /jupyter/ext
31
+ # COPY ./extensions/* /jupyter/ext
32
+ # RUN chmod 644 /jupyter/ext/*.py && \
33
+ # chown jovyan:users /jupyter/ext/*.py
34
+ # # copy entrypoint script
35
+ # RUN mkdir -p /scripts
36
+ # COPY ./scripts/start-server.sh /scripts
37
+ # COPY ./scripts/entrypoint.sh /scripts
38
+ # RUN chmod +x /scripts/start-server.sh
39
+ # RUN chmod +x /scripts/entrypoint.sh
40
+ # # set up matplotlib temp dir
41
+ # RUN mkdir -p /tmp/matplotlib
42
+ # RUN chmod 777 /tmp/matplotlib
43
+ # ENV MPLCONFIGDIR=/tmp/matplotlib
44
+ # ENV PYDEVD_DISABLE_FILE_VALIDATION=1
45
+ # # setup python environment
46
+ # ENV PYTHON_PACKAGES="\
47
+ # pystackql>=3.6.4 \
48
+ # matplotlib \
49
+ # pandas \
50
+ # mplfinance \
51
+ # psycopg2-binary \
52
+ # nest_asyncio \
53
+ # plotly \
54
+ # ipytree \
55
+ # nbformat \
56
+ # networkx \
57
+ # "
58
+ # RUN pip install --upgrade pip \
59
+ # && pip install --no-cache-dir $PYTHON_PACKAGES
60
+ # # copy stackql providers from stackql container
61
+ # COPY --from=stackql /home/stackql/.stackql /jupyter/.stackql
62
+ # RUN ls -al /jupyter/.stackql/src/aws || (echo "aws provider not present" && exit 1)
63
+ # RUN ls -al /jupyter/.stackql/src/googleapis.com || (echo "google provider not present" && exit 1)
64
+ # RUN ls -al /jupyter/.stackql/src/github || (echo "github provider not present" && exit 1)
65
+ # # copy stackql binary from stackql container (service instance)
66
+ # COPY --from=stackql /srv/stackql/stackql /srv/stackql/stackql
67
+
68
+ # Stage 1: StackQL setup
1
69
FROM stackql/stackql:latest AS stackql
2
70
EXPOSE 5444
3
71
WORKDIR /home/stackql
@@ -6,59 +74,70 @@ RUN addgroup --system --gid 1001 stackql
6
74
RUN chown stackql:stackql /home/stackql
7
75
RUN chown stackql:stackql /srv
8
76
USER stackql
9
- # pull stackql providers
77
+
78
+ # Pull stackql providers
10
79
RUN stackql exec 'registry pull aws' || (echo "Failed to pull aws provider" && exit 1)
11
80
RUN stackql exec 'registry pull google' || (echo "Failed to pull google provider" && exit 1)
12
81
RUN stackql exec 'registry pull github' || (echo "Failed to pull github provider" && exit 1)
13
82
RUN stackql exec 'registry pull azure' || (echo "Failed to pull azure provider" && exit 1)
14
- # RUN stackql exec 'registry pull k8s'
15
- # RUN stackql exec 'registry pull netlify'
16
- # RUN stackql exec 'registry pull okta'
17
- # RUN stackql exec 'registry pull sumologic'
18
- # RUN stackql exec 'registry pull digitalocean'
19
83
84
+ # Stage 2: Jupyter setup
20
85
FROM jupyter/base-notebook:latest AS jupyter
21
86
WORKDIR /jupyter
22
87
USER root
23
88
RUN apt-get update && \
24
89
apt-get upgrade -y
25
- # copy example notebooks to Jupyter workspace
90
+
91
+ # Copy example notebooks to Jupyter workspace
26
92
COPY ./notebooks/ /jupyter/
27
- RUN chmod 644 *.ipynb && \
28
- chown jovyan:users *.ipynb
29
- # copy magic extensions
93
+ RUN chmod 644 /jupyter/*.ipynb && \
94
+ chown jovyan:users /jupyter/*.ipynb
95
+
96
+ # Copy magic extensions
30
97
RUN mkdir -p /jupyter/ext
31
- COPY ./extensions/* /jupyter/ext
98
+ COPY ./extensions/* /jupyter/ext/
32
99
RUN chmod 644 /jupyter/ext/*.py && \
33
100
chown jovyan:users /jupyter/ext/*.py
34
- # copy entrypoint script
101
+
102
+ # Copy entrypoint script
35
103
RUN mkdir -p /scripts
104
+ COPY ./scripts/start-server.sh /scripts
36
105
COPY ./scripts/entrypoint.sh /scripts
37
- RUN chmod +x /scripts/entrypoint.sh
38
- # set up matplotlib temp dir
106
+ RUN chmod +x /scripts/start-server.sh /scripts/entrypoint.sh
107
+
108
+ # Set up matplotlib temp dir
39
109
RUN mkdir -p /tmp/matplotlib
40
110
RUN chmod 777 /tmp/matplotlib
41
111
ENV MPLCONFIGDIR=/tmp/matplotlib
42
112
ENV PYDEVD_DISABLE_FILE_VALIDATION=1
43
- # setup python environment
113
+
114
+ # Setup python environment
44
115
ENV PYTHON_PACKAGES="\
45
116
pystackql>=3.6.4 \
46
117
matplotlib \
47
118
pandas \
48
- mplfinance \
119
+ mplfinance \
49
120
psycopg2-binary \
50
121
nest_asyncio \
51
122
plotly \
52
123
ipytree \
53
124
nbformat \
54
125
networkx \
55
126
"
56
- RUN pip install --upgrade pip \
57
- && pip install --no-cache-dir $PYTHON_PACKAGES
58
- # copy stackql providers from stackql container
127
+ RUN pip install --upgrade pip && pip install --no-cache-dir $PYTHON_PACKAGES
128
+
129
+ # Copy stackql providers and binary from stackql container
59
130
COPY --from=stackql /home/stackql/.stackql /jupyter/.stackql
131
+ COPY --from=stackql /srv/stackql/stackql /srv/stackql/stackql
132
+
133
+ # Ensure providers are present
60
134
RUN ls -al /jupyter/.stackql/src/aws || (echo "aws provider not present" && exit 1)
61
135
RUN ls -al /jupyter/.stackql/src/googleapis.com || (echo "google provider not present" && exit 1)
62
136
RUN ls -al /jupyter/.stackql/src/github || (echo "github provider not present" && exit 1)
63
- # copy stackql binary from stackql container (service instance)
64
- COPY --from=stackql /srv/stackql/stackql /srv/stackql/stackql
137
+
138
+ # Set user back to default jovyan
139
+ USER jovyan
140
+
141
+ # Set entrypoint
142
+ # ENTRYPOINT ["/scripts/entrypoint.sh"]
143
+ # CMD ["start-notebook.sh"]
0 commit comments