forked from GoogleCloudPlatform/cloud-debug-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
36 lines (27 loc) · 1.15 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
# WARNING: Stackdriver Debugger is not regularly tested on the Alpine Linux
# platform and support will be on a best effort basis.
# Sample Alpine Linux image including Python and the Stackdriver Debugger agent.
# To build:
# docker build . # Python 2.7
# docker build --build-arg PYTHON_VERSION=3 . # Python 3.6
# The final image size should be around 50-60 MiB.
# Stage 1: Build the agent.
FROM alpine:latest
ARG PYTHON_VERSION=2
ENV PYTHON_VERSION=$PYTHON_VERSION
ENV PYTHON=python${PYTHON_VERSION}
RUN apk update
RUN apk add bash git curl gcc g++ make cmake ${PYTHON}-dev
RUN if [ $PYTHON_VERSION == "2" ]; then apk add py-setuptools; fi
RUN git clone https://github.com/GoogleCloudPlatform/cloud-debug-python
RUN PYTHON=$PYTHON bash cloud-debug-python/src/build.sh
# Stage 2: Create minimal image with just Python and the debugger.
FROM alpine:latest
ARG PYTHON_VERSION=2
ENV PYTHON_VERSION=$PYTHON_VERSION
ENV PYTHON=python${PYTHON_VERSION}
RUN apk --no-cache add $PYTHON libstdc++
RUN if [ $PYTHON_VERSION == "2" ]; then apk add --no-cache py-setuptools; fi
COPY --from=0 /cloud-debug-python/src/dist/*.egg .
RUN $PYTHON -m easy_install *.egg
RUN rm *.egg