Skip to content

Commit

Permalink
Add dockerfile to build update.tar
Browse files Browse the repository at this point in the history
  • Loading branch information
RafaelTaranto authored and joshmh committed Feb 1, 2019
1 parent f1c29a0 commit 131c5b7
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
./node_modules
./build
./update-tar-build
28 changes: 21 additions & 7 deletions deploy/codebase/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ EXPORT_BASE=$EXPORT_ROOT/$SUB_DIR
EXPORT_DIR=$EXPORT_BASE/subpackage
EXPORT_SCRIPT_DIR=$EXPORT_BASE/package
TARGET_MACHINE_DIR=$EXPORT_DIR/lamassu-machine
HARDWARE_DIR=$EXPORT_ROOT/hardware/codebase
HARDWARE_DIR=$MACHINE_DIR/hardware/codebase
BUILD_FILES_DIR=$MACHINE_DIR/deploy-files
UPDATESCRIPT=$SCRIPT_DIR/updateinit.js
TARGET_MODULES_DIR=$TARGET_MACHINE_DIR/node_modules

Expand All @@ -46,19 +47,32 @@ cp $MACHINE_DIR/package.json $TARGET_MACHINE_DIR
cp -r $MACHINE_DIR/lib $TARGET_MACHINE_DIR
cp -a $MACHINE_DIR/exec $TARGET_MACHINE_DIR
cp $MACHINE_DIR/bin/lamassu-machine $TARGET_MACHINE_DIR/bin
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
cp -a $HARDWARE_DIR $EXPORT_DIR/hardware

# Remove locally installed files
rm -rf $TARGET_MACHINE_DIR/ui/css/fonts/*
# Untar deploy-files
tar -xvf $MACHINE_DIR/deploy-files.tar.gz

# Copy back basic fonts
cp $MACHINE_DIR/ui/css/fonts/brandon_txt* $TARGET_MACHINE_DIR/ui/css/fonts
cp $MACHINE_DIR/ui/css/fonts/SourceCodePro-Regular.ttf $TARGET_MACHINE_DIR/ui/css/fonts
cp $MACHINE_DIR/ui/css/fonts/Noto* $TARGET_MACHINE_DIR/ui/css/fonts
cp -a $MACHINE_DIR/ui/css/fonts/SourceSansPro $TARGET_MACHINE_DIR/ui/css/fonts
mkdir -p $TARGET_MACHINE_DIR/ui/css/fonts
cp $BUILD_FILES_DIR/fonts/*.ttf $TARGET_MACHINE_DIR/ui/css/fonts
cp $BUILD_FILES_DIR/fonts/*.woff $TARGET_MACHINE_DIR/ui/css/fonts
cp -a $BUILD_FILES_DIR/fonts/SourceSansPro $TARGET_MACHINE_DIR/ui/css/fonts

# Copy licences.json
cp $BUILD_FILES_DIR/licenses.json $TARGET_MACHINE_DIR/licenses.json

# Copy aaeon node_modules
cp -R $BUILD_FILES_DIR/aaeon_node_modules $EXPORT_DIR/hardware/aaeon/node_modules

# Copy libBarcodeScanner.json
mkdir $EXPORT_DIR/hardware/aaeon/lib/
cp $BUILD_FILES_DIR/libBarcodeScanner.so $EXPORT_DIR/hardware/aaeon/lib/


# Reduce package size, these are unneeded
rm -rf $TARGET_MODULES_DIR/clim/example
Expand Down
2 changes: 1 addition & 1 deletion deploy/copy-modules.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/node
#!/usr/bin/env node

const fs = require('fs-extra')
const path = require('path')
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "lamassu-machine",
"license": "Unlicense",
"version": "7.2.0",
"version": "7.2.1",
"dependencies": {
"@lamassu/camera-wrapper": "^1.0.1",
"async": "~0.2.9",
"@lamassu/camera-wrapper": "1.0.1",
"async": "~1.5.2",
"base-x": "^3.0.0",
"bignumber.js": "^4.0.1",
"bs58check": "^2.0.2",
Expand Down
28 changes: 28 additions & 0 deletions update-tar-build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM ubuntu:14.04

RUN apt-get update && apt-get -y upgrade && \
apt-get install -y git node npm build-essential cmake libgtk2.0-dev \
pkg-config libavcodec-dev libavformat-dev libswscale-dev libpcsclite-dev \
libopencv-core-dev libopencv-highgui-dev libopencv-imgproc-dev \
libopencv-video-dev libopencv-features2d-dev libopencv-objdetect-dev

ENV WORK=/usr/app

RUN npm config set strict-ssl false
RUN npm cache clean -f
RUN npm install -g n
# only to use npm@2
RUN n 4
RUN npm -v

WORKDIR $WORK

COPY ./package.json ./package.json

RUN npm install

COPY ./ $WORK/

VOLUME ["/usr/app/deploy-files.tar.gz"]

CMD ["deploy/codebase/build.sh"]
11 changes: 11 additions & 0 deletions update-tar-build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Update.tar builder

## Guide

- Download deploy-files.tar.gz from lamassu DO space

- Build the Dockerfile by running the following command on project root:
`docker build -t lamassu-update -f update-tar-build/Dockerfile .`

- Run the image to perform the build:
`docker run -v <build>:/usr/app/build -v <lamassu-machine/deploy-files location>:/usr/app/deploy-files.tar.gz lamassu-update`

0 comments on commit 131c5b7

Please sign in to comment.