Skip to content

Commit af81d7f

Browse files
committed
Dockerfile: added alpine builders
1 parent fbb90b4 commit af81d7f

File tree

5 files changed

+119
-2
lines changed

5 files changed

+119
-2
lines changed

.github/workflows/build-pack-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
arch: [x64, arm, arm64]
17+
arch: [x64, arm, arm64, alpine, alpine-arm, alpine-arm64]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- uses: docker/setup-qemu-action@v1

Dockerfile-alpine

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Usage:
2+
#
3+
# docker build -t bcryptjs-linux-alpine-builder -f Dockerfile-alpine .
4+
# CONTAINER=$(docker create bcryptjs-linux-alpine-builder)
5+
# # Then copy the artifact to your host:
6+
# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" .
7+
# docker rm "$CONTAINER"
8+
9+
FROM node:14-alpine
10+
11+
ENV project bcrypt-js
12+
ENV DEBIAN_FRONTEND noninteractive
13+
ENV LC_ALL en_US.UTF-8
14+
ENV LANG ${LC_ALL}
15+
16+
RUN echo "#log: ${project}: Setup system" \
17+
&& set -x \
18+
&& apk add --update build-base python3 \
19+
&& npm i -g prebuildify node-gyp nodeunit \
20+
&& sync
21+
22+
ADD . /usr/local/opt/${project}
23+
WORKDIR /usr/local/opt/${project}
24+
25+
RUN echo "#log: ${project}: Running build" \
26+
&& set -x \
27+
&& npm ci \
28+
&& npm run build
29+
30+
ARG RUN_TESTS=true
31+
32+
RUN if "${RUN_TESTS}"; then \
33+
echo "#log ${project}: Running tests" \
34+
&& npm test; \
35+
else \
36+
echo "#log ${project}: Tests were skipped!"; \
37+
fi
38+
39+
CMD /bin/bash -l

Dockerfile-alpine-arm

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Usage:
2+
#
3+
# docker build -t bcryptjs-alpine-arm-builder -f Dockerfile-arm .
4+
# CONTAINER=$(docker create bcryptjs-alpine-arm-builder)
5+
# # Then copy the artifact to your host:
6+
# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" .
7+
# docker rm "$CONTAINER"
8+
9+
FROM arm32v7/node:14-alpine
10+
11+
ENV project bcrypt-js
12+
ENV DEBIAN_FRONTEND noninteractive
13+
ENV LC_ALL en_US.UTF-8
14+
ENV LANG ${LC_ALL}
15+
16+
RUN echo "#log: ${project}: Setup system" \
17+
&& set -x \
18+
&& apk add --update build-base python3 \
19+
&& npm i -g prebuildify node-gyp nodeunit \
20+
&& sync
21+
22+
ADD . /usr/local/opt/${project}
23+
WORKDIR /usr/local/opt/${project}
24+
25+
RUN echo "#log: ${project}: Running build" \
26+
&& set -x \
27+
&& npm ci \
28+
&& npm run build
29+
30+
ARG RUN_TESTS=true
31+
32+
RUN if "${RUN_TESTS}"; then \
33+
echo "#log ${project}: Running tests" \
34+
&& npm test; \
35+
else \
36+
echo "#log ${project}: Tests were skipped!"; \
37+
fi
38+
39+
CMD /bin/bash -l

Dockerfile-alpine-arm64

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Usage:
2+
#
3+
# docker build -t bcryptjs-alpine-arm-builder -f Dockerfile-arm .
4+
# CONTAINER=$(docker create bcryptjs-alpine-arm-builder)
5+
# # Then copy the artifact to your host:
6+
# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" .
7+
# docker rm "$CONTAINER"
8+
9+
FROM arm64v8/node:14-alpine
10+
11+
ENV project bcrypt-js
12+
ENV DEBIAN_FRONTEND noninteractive
13+
ENV LC_ALL en_US.UTF-8
14+
ENV LANG ${LC_ALL}
15+
16+
RUN echo "#log: ${project}: Setup system" \
17+
&& set -x \
18+
&& apk add --update build-base python3 \
19+
&& npm i -g prebuildify node-gyp nodeunit \
20+
&& sync
21+
22+
ADD . /usr/local/opt/${project}
23+
WORKDIR /usr/local/opt/${project}
24+
25+
RUN echo "#log: ${project}: Running build" \
26+
&& set -x \
27+
&& npm ci \
28+
&& npm run build
29+
30+
ARG RUN_TESTS=true
31+
32+
RUN if "${RUN_TESTS}"; then \
33+
echo "#log ${project}: Running tests" \
34+
&& npm test; \
35+
else \
36+
echo "#log ${project}: Tests were skipped!"; \
37+
fi
38+
39+
CMD /bin/bash -l

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"scripts": {
2828
"test": "npx nodeunit test/*.js",
2929
"install": "node-gyp-build",
30-
"build": "prebuildify --napi"
30+
"build": "prebuildify --napi --tag-libc --strip"
3131
},
3232
"dependencies": {
3333
"node-addon-api": "^3.1.0",

0 commit comments

Comments
 (0)