Skip to content

Commit

Permalink
refactor using variable for emsk image
Browse files Browse the repository at this point in the history
  • Loading branch information
lilachic committed Feb 22, 2024
1 parent a216179 commit 1e0e6a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 6 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ARG EMSCRIPTEN_VERSION=3.1.51
ARG EMSDK_IMAGE=docker.io/emscripten/emsdk

# Build libsodium
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS SODIUM
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS SODIUM

ARG LIBSODIUM_VERSION=1.0.19-stable

Expand All @@ -13,7 +14,7 @@ RUN tar xvf libsodium-${LIBSODIUM_VERSION}.tar.gz \
&& dist-build/emscripten.sh --sumo

# Build openssl
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS OPENSSL
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS OPENSSL

ARG OPENSSL_VERSION=1.1.1w

Expand All @@ -31,7 +32,7 @@ RUN bash -c 'echo "$(cat openssl-${OPENSSL_VERSION}.tar.gz.sha256) openssl-${OPE
&& emmake make install

# Build libcrypt4gh
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS LIBCRYPT4GH
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS LIBCRYPT4GH

RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache

Expand All @@ -58,7 +59,7 @@ RUN export EMCC_CFLAGS="-I/emsdk/upstream/include -L/emsdk/upstream/lib" \
&& emmake make install

# Build libcrypt4gh-keys
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS LIBCRYPT4GHKEYS
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS LIBCRYPT4GHKEYS

COPY --from=SODIUM /src/libsodium-stable/libsodium-js-sumo/include/ /emsdk/upstream/include/
COPY --from=SODIUM /src/libsodium-stable/libsodium-js-sumo/lib/ /emsdk/upstream/lib/
Expand Down Expand Up @@ -86,7 +87,7 @@ RUN export EMCC_CFLAGS="-I/emsdk/upstream/include -L/emsdk/upstream/lib" \
&& emmake make install

# Build wasm application
FROM docker.io/emscripten/emsdk:$EMSCRIPTEN_VERSION AS WASMCRYPT
FROM ${EMSDK_IMAGE}:${EMSCRIPTEN_VERSION} AS WASMCRYPT

LABEL maintainer="CSC Developers"
LABEL org.label-schema.schema-version="1.0"
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ Build your application
## Extras
You can provide argument variables to change which library versions get built.

`emscripten`, `libsodium`, and `openssl` versions can be changed with `--build-arg` by changing the value of `EMSCRIPTEN_VERSION`, `LIBSODIUM_VERSION`, and `OPENSSL_VERSION`.
`emscripten`, `libsodium`, and `openssl` versions can be changed with `--build-arg` by changing the value of `EMSCRIPTEN_VERSION`, `LIBSODIUM_VERSION`, `EMSDK_IMAGE` and `OPENSSL_VERSION`.

>__NOTE:__ To build only ARM images use -arm in version tag and for ARM built images. For example `EMSDK_IMAGE --build-arg="EMSDK_IMAGE=sds-docker-local.artifactory.ci.csc.fi/sd-connect/emscripten/emsdk" --build-arg="EMSCRIPTEN_VERSION=3.1.21-arm"` instructs to use locally build emsdk:3.1.21-arm container.
# License

Expand Down

0 comments on commit 1e0e6a0

Please sign in to comment.