-
Notifications
You must be signed in to change notification settings - Fork 519
/
Dockerfile
executable file
·57 lines (48 loc) · 1.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Usage:
#
# docker build -t bcryptjs-builder .
# CONTAINER=$(docker create bcryptjs-builder)
# # Then copy the artifact to your host:
# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" .
# docker rm "$CONTAINER"
#
# Use --platform to build cross-platform i.e. for ARM:
#
# docker build -t bcryptjs-builder --platform "linux/arm64/v8" .
# CONTAINER=$docker create --platform "linux/arm64/v8" bcryptjs-builder)
# # this copies the prebuilds/linux-arm artifacts
# docker cp "$CONTAINER:/usr/local/opt/bcrypt-js/prebuilds" .
# docker rm "$CONTAINER"
ARG FROM_IMAGE=node:18-bullseye
#ARG FROM_IMAGE=arm32v7/node:16-bullseye
#ARG FROM_IMAGE=arm64v8/node:16-bullseye
FROM ${FROM_IMAGE}
ENV project bcrypt-js
ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL en_US.UTF-8
ENV LANG ${LC_ALL}
RUN echo "#log: ${project}: Setup system" \
&& set -x \
&& apt-get update -y \
&& apt-get install -y \
build-essential \
python3 \
&& apt-get clean \
&& update-alternatives --install /usr/local/bin/python python /usr/bin/python3 20 \
&& npm i -g prebuildify@5 node-gyp@9 \
&& sync
ADD . /usr/local/opt/${project}
WORKDIR /usr/local/opt/${project}
RUN echo "#log: ${project}: Running build" \
&& set -x \
&& npm ci \
&& npm run build
ARG RUN_TESTS=true
ARG TEST_TIMEOUT_SECONDS=
RUN if "${RUN_TESTS}"; then \
echo "#log ${project}: Running tests" \
&& npm test; \
else \
echo "#log ${project}: Tests were skipped!"; \
fi
CMD /bin/bash -l