Skip to content

Commit

Permalink
Add arch option to Dockerfile build
Browse files Browse the repository at this point in the history
Set -march=x86-64 to build images on GitHub CI.
  • Loading branch information
sbellem committed Apr 10, 2022
1 parent a1c524f commit 073a2a8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
target: base
build-args: arch=x86-64
tags: |
initc3/mpspdz,
initc3/mpspdz:${{ github.head_ref }},
Expand Down Expand Up @@ -56,6 +57,7 @@ jobs:
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: |
arch=x86-64
program=malicious-shamir-party.x
prep_dir=/opt/preprocessing-data
tags: |
Expand Down Expand Up @@ -84,7 +86,9 @@ jobs:
context: .
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: program=mal-shamir-offline.x
build-args: |
arch=x86-64
program=mal-shamir-offline.x
tags: |
initc3/mal-shamir-offline.x,
initc3/mal-shamir-offline.x:${{ github.head_ref }},
Expand Down Expand Up @@ -112,6 +116,7 @@ jobs:
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: |
arch=x86-64
program=random-shamir.x
prep_dir=/opt/inputmask-shares
tags: |
Expand Down Expand Up @@ -140,6 +145,7 @@ jobs:
context: .
file: mal-shamir.Dockerfile
builder: ${{ steps.buildx.outputs.name }}
build-args: arch=x86-64
tags: |
initc3/mal-shamir,
initc3/mal-shamir:${{ github.head_ref }},
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
builder: ${{ steps.buildx.outputs.name }}
target: base
push: true
build-args: arch=x86-64
tags: |
initc3/mpspdz,
initc3/mpspdz:${{ github.ref_name }},
Expand Down Expand Up @@ -72,14 +73,15 @@ jobs:
builder: ${{ steps.buildx.outputs.name }}
push: true
build-args: |
arch=x86-64
program=malicious-shamir-party.x
prep_dir=/opt/preprocessing-data
tags: |
initc3/malicious-shamir-party.x,
initc3/malicious-shamir-party.x:${{ github.ref_name }},
initc3/malicious-shamir-party.x:${{ steps.vars.outputs.short_sha }}
#cache-from: type=registry,ref=initc3/malicious-shamir-party.x:buildcache
#cache-to: type=registry,ref=initc3/malicious-shamir-party.x:buildcache,mode=max
cache-from: type=registry,ref=initc3/malicious-shamir-party.x:buildcache
cache-to: type=registry,ref=initc3/malicious-shamir-party.x:buildcache,mode=max

mal-shamir-offline:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -109,13 +111,15 @@ jobs:
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
build-args: program=mal-shamir-offline.x
build-args: |
arch=x86-64
program=mal-shamir-offline.x
tags: |
initc3/mal-shamir-offline.x,
initc3/mal-shamir-offline.x:${{ github.ref_name }},
initc3/mal-shamir-offline.x:${{ steps.vars.outputs.short_sha }}
#cache-from: type=registry,ref=initc3/mal-shamir-offline.x:buildcache
#cache-to: type=registry,ref=initc3/mal-shamir-offline.x:buildcache,mode=max
cache-from: type=registry,ref=initc3/mal-shamir-offline.x:buildcache
cache-to: type=registry,ref=initc3/mal-shamir-offline.x:buildcache,mode=max

random-shamir:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -146,14 +150,15 @@ jobs:
builder: ${{ steps.buildx.outputs.name }}
push: true
build-args: |
arch=x86-64
program=random-shamir.x
prep_dir=/opt/inputmask-shares
tags: |
initc3/random-shamir.x,
initc3/random-shamir.x:${{ github.ref_name }},
initc3/random-shamir.x:${{ steps.vars.outputs.short_sha }}
#cache-from: type=registry,ref=initc3/random-shamir.x:buildcache
#cache-to: type=registry,ref=initc3/random-shamir.x:buildcache,mode=max
cache-from: type=registry,ref=initc3/random-shamir.x:buildcache
cache-to: type=registry,ref=initc3/random-shamir.x:buildcache,mode=max

mal-shamir:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -183,9 +188,10 @@ jobs:
file: mal-shamir.Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
build-args: arch=x86-64
tags: |
initc3/mal-shamir,
initc3/mal-shamir:${{ github.ref_name }},
initc3/mal-shamir:${{ steps.vars.outputs.short_sha }}
#cache-from: type=registry,ref=initc3/mal-shamir:buildcache
#cache-to: type=registry,ref=initc3/mal-shamir:buildcache,mode=max
cache-from: type=registry,ref=initc3/mal-shamir:buildcache
cache-to: type=registry,ref=initc3/mal-shamir:buildcache,mode=max
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,20 @@ RUN pip install --upgrade pip ipython

COPY . .

RUN echo "CXX = clang++-11" >> CONFIG.mine \
ARG arch=native
RUN echo "ARCH = -march=${arch}" >> CONFIG.mine \
&& echo "CXX = clang++-11" >> CONFIG.mine \
&& echo "USE_NTL = 1" >> CONFIG.mine \
&& echo "MY_CFLAGS += -I/usr/local/include" >> CONFIG.mine \
&& echo "MY_LDLIBS += -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib" >> CONFIG.mine

# ssl keys
ARG n=4
RUN ./Scripts/setup-ssl.sh $n

# DEBUG and configuration flags
RUN echo "MY_CFLAGS += -DDEBUG_NETWORKING" >> CONFIG.mine \
&& echo "MY_LDLIBS += -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_NETWORKING" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DVERBOSE" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_MAC" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_FILE" >> CONFIG.mine

# ssl keys
ARG n=4
RUN ./Scripts/setup-ssl.sh $n

FROM base as program

Expand Down
16 changes: 8 additions & 8 deletions mal-shamir.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ RUN pip install --upgrade pip ipython

COPY . .

RUN echo "CXX = clang++-11" >> CONFIG.mine \
ARG arch=native
RUN echo "ARCH = -march=${arch}" >> CONFIG.mine \
&& echo "CXX = clang++-11" >> CONFIG.mine \
&& echo "USE_NTL = 1" >> CONFIG.mine \
&& echo "MY_CFLAGS += -I/usr/local/include" >> CONFIG.mine \
&& echo "MY_LDLIBS += -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib" >> CONFIG.mine
&& echo "MY_LDLIBS += -Wl,-rpath -Wl,/usr/local/lib -L/usr/local/lib" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_NETWORKING" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DVERBOSE" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_MAC" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_FILE" >> CONFIG.mine

# ssl keys
ARG n=4
RUN ./Scripts/setup-ssl.sh $n

# DEBUG and configuration flags
RUN echo "MY_CFLAGS += -DDEBUG_NETWORKING" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DVERBOSE" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_MAC" >> CONFIG.mine \
&& echo "MY_CFLAGS += -DDEBUG_FILE" >> CONFIG.mine


FROM base as programs

Expand Down

0 comments on commit 073a2a8

Please sign in to comment.