Skip to content

Commit

Permalink
Improve docker for update.tar
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelTaranto authored and joshmh committed Feb 2, 2019
1 parent 3cb2f76 commit 50c8712
Show file tree
Hide file tree
Showing 8 changed files with 596 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
./node_modules
./build
./update-tar-build
./update-tar-build
./hardware/codebase/aaeon/node_modules
8 changes: 8 additions & 0 deletions bin/build-update-tar
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [ -z $1 ] || [ -z $2 ]; then
echo "Usage: npm run build-update-tar -- <path/to/build/folder> <path/to/deploy-files.tar.gz>"
else
docker build -t lamassu-update -f update-tar-build/Dockerfile .
docker run -v $1:/usr/app/build -v $2:/usr/app/deploy-files.tar.gz lamassu-update
fi
5 changes: 4 additions & 1 deletion deploy/codebase/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ cp $MACHINE_DIR/bin/cam.js $TARGET_MACHINE_DIR/bin
cp $MACHINE_DIR/bin/mock-cam.js $TARGET_MACHINE_DIR/bin

cp -r $MACHINE_DIR/ui $TARGET_MACHINE_DIR
$MACHINE_DIR/deploy/copy-modules.js $MACHINE_DIR/node_modules $TARGET_MODULES_DIR
$MACHINE_DIR/node_modules/.bin/copy-node-modules $MACHINE_DIR $TARGET_MACHINE_DIR

# remove native modules
node $MACHINE_DIR/deploy/remove-modules.js $TARGET_MACHINE_DIR/node_modules
cp -a $HARDWARE_DIR $EXPORT_DIR/hardware

# Untar deploy-files
Expand Down
21 changes: 0 additions & 21 deletions deploy/copy-modules.js

This file was deleted.

20 changes: 20 additions & 0 deletions deploy/remove-modules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const fs = require('fs-extra')
const path = require('path')
var rimraf = require("rimraf");

const base = process.argv[2]

const isNative = m => {
const isNative = fs.existsSync(path.resolve(base, m, 'build', 'Release'))

// TODO this is awfully manual right now.
const mappedNative = m === '@lamassu' || m === '@pokusew'

return isNative || mappedNative
}

fs.readdirSync(base)
.filter(isNative)
.forEach(it => rimraf.sync(path.resolve(path.join(base, it))))
Loading

0 comments on commit 50c8712

Please sign in to comment.