File tree 3 files changed +34
-15
lines changed
3 files changed +34
-15
lines changed Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
- FROM jeanblanchard/alpine-glibc
16
- COPY ./dist/ /sbin/
17
- CMD ["/sbin/policy_agent" ]
15
+ FROM alpine:3.3
16
+
17
+ ADD *.py /code/
18
+ ADD handlers /code/handlers
19
+
20
+ ADD build.sh /build.sh
21
+ RUN /build.sh
22
+
23
+ # Symlinks needed to workaround Alpine/Pyinstaller incompatibilties
24
+ # https://github.com/gliderlabs/docker-alpine/issues/48
25
+ RUN ln -s /lib/libc.musl-x86_64.so.1 ldd
26
+ RUN ln -s /lib /lib64
27
+ RUN ln -s /lib/ld-musl-x86_64.so.1 /lib64/ld-linux-x86-64.so.2
28
+
29
+ CMD ["/dist/policy_agent" ]
Original file line number Diff line number Diff line change @@ -5,23 +5,13 @@ SRCDIR=.
5
5
default : all
6
6
all : policy-agent policy-tool
7
7
8
- # Build the policy agent binary.
9
- policy-agent : dist/policy_agent
10
-
11
8
# Build the policy command line tool.
12
9
policy-tool : dist/policy
13
10
14
11
# Build the calico/k8s-policy-agent Docker container.
15
12
docker-image : image.created
16
13
17
- dist/policy_agent :
18
- # Build the kubernetes policy agent
19
- docker run --rm \
20
- -v ` pwd` :/code \
21
- calico/build \
22
- pyinstaller policy_agent.py -ayF
23
-
24
- dist/policy : $(shell find policy_tool)
14
+ dist/policy : $(shell find policy_tool)
25
15
# Build NetworkPolicy install tool.
26
16
docker run --rm \
27
17
-v ` pwd` :/code \
34
24
calico/test \
35
25
nosetests tests/unit -c nose.cfg
36
26
37
- image.created : dist/policy_agent
27
+ image.created :
38
28
# Build the docker image for the policy agent.
39
29
docker build -t calico/k8s-policy-agent .
40
30
touch image.created
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+ set -e
3
+ set -x
4
+
5
+ # Install the system packages needed for building the PyInstaller based binary
6
+ apk -U add --virtual temp python-dev py-pip alpine-sdk python py-setuptools
7
+
8
+ # Install python dependencies
9
+ pip install -r https://raw.githubusercontent.com/projectcalico/libcalico/master/build-requirements.txt
10
+ pip install git+https://github.com/projectcalico/libcalico.git
11
+
12
+ # Produce a binary - outputs to /dist/policy_agent
13
+ pyinstaller /code/policy_agent.py -ayF
14
+
15
+ # Cleanup everything that was installed now that we have a self contained binary
16
+ apk del temp && rm -rf /var/cache/apk/*
17
+ rm -rf /usr/lib/python2.7
You can’t perform that action at this time.
0 commit comments