Skip to content

Instantly share code, notes, and snippets.

@kwccoin
Forked from manrajgrover/.env.sample
Created December 20, 2019 01:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwccoin/bc5eb4dffa3c5dec6b94cc1dfe39ec9b to your computer and use it in GitHub Desktop.
Save kwccoin/bc5eb4dffa3c5dec6b94cc1dfe39ec9b to your computer and use it in GitHub Desktop.
Quick Docker Environment for TensorFlowJS Node
root=/path/to/root
project=/path/to/project

Quick Docker environment for TensorFlowJS Node

Personal docker environment for TensorFlowJS Node for Development purpose

Why?

Because:

  1. I didn't want to install Xcode (which also takes up a lot of space)
  2. Easy to setup on different machines

How to use this?

Assuming you have Docker setup completed:

If you plan to make use of compose file shared here:

  1. Create a .env file from .env.sample and specify root and project volumes.

And then:

  1. Run $ docker-compose build command to build the image
  2. Run $ docker-compose run tensorflowjs command to run the container.

Otherwise:

  1. Run $ docker build . command to build the image
  2. Run $ docker run -it --rm <imageid> command to run the container.

Why is this not on DockerHub?

I haven't given it much thought

version: '3'
services:
tensorflowjs:
build:
context: .
dockerfile: Dockerfile
image: tfjs-node:cpu
env_file:
- .env
volumes:
- "${root}:/root"
- "${project}:/root/project"
command: /bin/bash
FROM ubuntu:16.04
LABEL maintainer="Manraj Singh Grover <manrajsinghgrover@gmail.com>"
# Install basic CLI tools etc.
RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \
build-essential \
curl \
git-core \
iputils-ping \
pkg-config \
rsync \
software-properties-common \
unzip \
wget
# Install NodeJS
RUN curl --silent --location https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install --yes nodejs
# Install yarn
RUN npm install -g yarn
# Install tfjs-node
RUN yarn add @tensorflow/tfjs
RUN yarn add @tensorflow/tfjs-node
# Clean up commands
RUN apt-get autoremove -y && apt-get clean && \
rm -rf /usr/local/src/*
RUN apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR "/root/project"
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment