Skip to content

Commit 0531e04

Browse files
authored
Fix dockerfile / linux build script (#50)
* Remove specific branch name from `Dockerfile.` * Improve `build-linux.sh`.
1 parent 7ddf86f commit 0531e04

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN curl https://www.libraw.org/data/LibRaw-0.21.1.tar.gz --output LibRaw-0.21.1
1010
RUN tar xzvf LibRaw-0.21.1.tar.gz && cd LibRaw-0.21.1 && ./configure --with-pic --disable-openmp && touch * && make && make install && cd ../
1111
RUN npm i -g node-gyp node-gyp-build prebuildify
1212
RUN git clone https://github.com/justinkambic/libraw.js.git
13-
RUN cd libraw.js && git checkout upgrade-to-libraw-21.1 && npm install && npm run format-check && npm run lint && npm run build && npm test && prebuildify --napi
13+
RUN cd libraw.js && git pull origin master && npm install && npm run format-check && npm run lint && npm run build && npm test && prebuildify --napi
1414

1515
WORKDIR /libraw.js
1616

build-linux.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,37 @@ CURRENT_LIBRAWJS_VERSION=2.3.0
22
PREBUILD_PATH="prebuilds/linux-x64"
33
NODE_FILE_NAME="node.napi.node"
44
OUTPUT_PATH="./${PREBUILD_PATH}/${NODE_FILE_NAME}"
5+
BACKUP_PATH="./${PREBUILD_PATH}/bak.${NODE_FILE_NAME}"
56
IMAGE_TAG_NAME="libraw.js:${CURRENT_LIBRAWJS_VERSION}"
67

8+
echo "Output path is ${OUTPUT_PATH}";
9+
710
if [ ! -d ${PREBUILD_PATH} ]; then
811
echo "Linux prebuild dir does not exist, creating.";
912
mkdir -p ${PREBUILD_PATH};
1013
else
1114
echo "Linux prebuild dir exists.";
1215
fi
1316

17+
if [ -f ${OUTPUT_PATH} ]; then
18+
echo "Linux prebuild file exists. Backing up.";
19+
mv ${OUTPUT_PATH} ${BACKUP_PATH};
20+
fi
21+
1422
DOCKER_BUILDKIT=1
1523

16-
docker build -t ${IMAGE_TAG_NAME} --output ${OUTPUT_PATH} .
24+
docker build -t ${IMAGE_TAG_NAME} --output ${PREBUILD_PATH} --no-cache .
25+
26+
DOCKER_EXIT_CODE=$?
27+
28+
if [ -f ${BACKUP_PATH} ] && [ $DOCKER_EXIT_CODE -eq 0 ]; then
29+
echo "Binary build succeeded. Deleting backup file."
30+
rm ${BACKUP_PATH};
31+
fi
32+
33+
if [ $DOCKER_EXIT_CODE -eq 0 ]; then
34+
echo "Linux build complete.";
35+
else
36+
echo "Docker build failed."
37+
exit 1;
38+
fi

0 commit comments

Comments
 (0)