Skip to content

Commit cf6da50

Browse files
committed
CircleCI: multiarch docker build #7
1 parent d6b602a commit cf6da50

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

opt/build/docker/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ BUILD_OPT=--rm
2121
FETCH_ARGS.arm64v8=WITH_ORT=0
2222
BUILD_ARGS.arm64v8=WITH_ORT=0
2323

24-
FETCH_ARGS.arm32v7=WITH_ORT=0
25-
BUILD_ARGS.arm32v7=WITH_ORT=0
24+
FETCH_ARGS.arm32v7=WITH_ORT=0 WITH_PT=0
25+
BUILD_ARGS.arm32v7=WITH_ORT=0 WITH_PT=0
2626

2727
#----------------------------------------------------------------------------------------------
2828

@@ -42,7 +42,7 @@ $(eval $(call targets,PUSH,push))
4242

4343
define build_x64 # (1=arch)
4444
build_$(1):
45-
@docker build $(BUILD_OPT) -t $(STEM)-$(OSNICK):$(VERSION)-x64 -f $(ROOT)/Dockerfile \
45+
docker build $(BUILD_OPT) -t $(STEM)-$(OSNICK):$(VERSION)-x64 -f $(ROOT)/Dockerfile \
4646
--build-arg FETCH_ARGS="$(FETCH_ARGS.x64)" \
4747
--build-arg BUILD_ARGS="$(BUILD_ARGS.x64)" \
4848
$(ROOT)
@@ -52,7 +52,7 @@ endef
5252

5353
define build_arm # (1=arch)
5454
build_$(1):
55-
@docker build $(BUILD_OPT) -t $(STEM)-$(OSNICK):$(VERSION)-$(1) -f $(ROOT)/Dockerfile.arm \
55+
docker build $(BUILD_OPT) -t $(STEM)-$(OSNICK):$(VERSION)-$(1) -f $(ROOT)/Dockerfile.arm \
5656
--build-arg ARCH=$(1) \
5757
--build-arg FETCH_ARGS="$(FETCH_ARGS.$(1))" \
5858
--build-arg BUILD_ARGS="$(BUILD_ARGS.$(1))" \
@@ -63,7 +63,7 @@ endef
6363

6464
define push # (1=arch)
6565
push_$(1):
66-
@docker push $(STEM)-$(OSNICK):$(VERSION)-$(1)
66+
docker push $(STEM)-$(OSNICK):$(VERSION)-$(1)
6767

6868
.PHONY: push_$(1)
6969
endef

opt/build/libtorch/Dockerfile.arm

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ ARG ARCH=arm64v8
99
#----------------------------------------------------------------------------------------------
1010
FROM redisfab/${ARCH}-xbuild:${OSNICK} as builder
1111

12-
ARG PT_VER=1.1.0
12+
# redeclare
13+
ARG OSNICK
14+
ARG ARCH
15+
16+
ARG PT_VER=1.2.0
1317

1418
RUN [ "cross-build-start" ]
1519

@@ -22,12 +26,9 @@ RUN pip3 install setuptools pyyaml typing
2226
RUN pip3 install numpy
2327
# RUN pip3 install mkl mkl-include
2428

25-
RUN set -e ;\
26-
git clone https://github.com/pytorch/pytorch.git ;\
27-
cd pytorch ;\
28-
git checkout "v${PT_VER}" ;\
29-
git submodule update --init --recursive
29+
RUN git clone --single-branch --branch v${PT_VER} --recursive https://github.com/pytorch/pytorch.git
3030

31+
ENV
3132
ENV BUILD_PYTHON=0
3233
ENV USE_GLOO=1
3334
ENV USE_OPENCV=0
@@ -39,13 +40,14 @@ ENV NO_DISTRIBUTED=1
3940
ENV NO_MKLDNN=1
4041
ENV NO_NNPACK=1
4142
ENV NO_QNNPACK=1
43+
ENV CFLAGS="-mfpu=neon -mfloat-abi=hard"
4244

4345
RUN set -e ;\
4446
cd pytorch ;\
4547
python3 setup.py install
4648

4749
ADD ./opt/readies/ /build/readies/
48-
ADD ./opt/build/libtorch-arm/collect.py /build/
50+
ADD ./opt/build/libtorch/collect.py /build/
4951

5052
RUN ./collect.py
5153

opt/build/libtorch/Dockerfile.x64

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ARG OS=debian:buster
33
#----------------------------------------------------------------------------------------------
44
FROM ${OS}
55

6-
ARG PT_VER=1.1.0
6+
ARG PT_VER=1.2.0
77

88
WORKDIR /build
99

@@ -14,11 +14,7 @@ RUN pip3 install setuptools pyyaml typing
1414
RUN pip3 install numpy
1515
RUN pip3 install mkl mkl-include
1616

17-
RUN set -e ;\
18-
git clone https://github.com/pytorch/pytorch.git ;\
19-
cd pytorch ;\
20-
git checkout "v${PT_VER}" ;\
21-
git submodule update --init --recursive
17+
RUN git clone --single-branch --branch v${PT_VER} --recursive https://github.com/pytorch/pytorch.git
2218

2319
ENV BUILD_PYTHON=0
2420
ENV USE_GLOO=1
@@ -37,6 +33,6 @@ RUN set -e ;\
3733
python3 setup.py install
3834

3935
ADD ./opt/readies/ /build/readies/
40-
ADD ./opt/build/libtorch-arm/collect.py /build/
36+
ADD ./opt/build/libtorch/collect.py /build/
4137

42-
RUN ./collect.py
38+
RUN ./collect.py

0 commit comments

Comments
 (0)