Giter Site home page Giter Site logo

webispy / docker-artik-devenv Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 4.0 32 KB

Dockerfile for ARTIK development environment

License: MIT License

Vim Script 17.93% Shell 18.07% Dockerfile 64.00%
docker artik tizenrt deb rpm sbuild fed-artik-tools mk-sbuild

docker-artik-devenv's Introduction

Docker Pulls Build Status

ARTIK Developer environment docker :)

  • https://hub.docker.com/r/webispy/artik_devenv/
  • Supports TizenRT build environment
  • Supports weird network environment (proxy and custom certificate)
  • Supports zsh (with oh-my-zsh)
  • Supports use of user account instead of root. (account name: 'work')
  • Supports RPM build environment (fed-artik-tools)
  • Supports DEB build environment (sbuild)

Install the Docker

$ sudo add-apt-repository \
	"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
	$(lsb_release -cs) \
	stable"
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

$ sudo apt-get update
$ sudo apt install docker-ce

Quick start

  • Install qemu-user-static
$ sudo apt install binfmt-support qemu-user-static
$ update-binfmts --display
  • Run docker with prebuilt image from docker hub
# Basic usage
$ docker run -it --name haha webispy/artik_devenv
➜  ~~ {build your source code}
➜  ~ exit

# Re-use the previous container
$ docker start haha
$ docker attach haha
➜  ~~ {build your source code}
➜  ~ exit

# Run with host system sharing (USB device, SSH configuration)
$ docker run -it -v /dev/bus/usb:/dev/bus/usb -v ~/.ssh:/home/work/.ssh --privileged --name haha webispy/artik_devenv

# Run with proxy configuration (proxy address: x.x.x.x, proxy port: n)
$ docker run -it -v /dev/bus/usb:/dev/bus/usb -v ~/.ssh:/home/work/.ssh --privileged -e http_proxy=http://x.x.x.x:n -e https_proxy=http://x.x.x.x:n --name haha webispy/artik_devenv

Customizing the docker service

Proxy environment

$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ sudo vi /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://x.x.x.x:8080"

$ sudo vi /etc/systemd/system/docker.service.d/https-proxy.conf
[Service]
Environment="HTTPS_PROXY=http://x.x.x.x:8080"

$ sudo systemctl daemon-reload
$ sudo systemctl restart docker

Use custom path to the docker data storage (e.g. SSD)

$ sudo systemctl stop docker

# Move original docker storage to custom path (e.g. /ssd)
$ sudo mv /var/lib/docker /ssd/

# Modify configuration file
$ sudo vi /etc/docker/daemon.json
{
	"graph": "/ssd/docker"
}

$ sudo systemctl start docker

DNS setting (Because sometimes DNS resolving does not work...)

# Get DNS list
$ nmcli dev show | grep DNS

# Add DNS to configuration file
$ sudo vi /etc/docker/daemon.json
{
	...,
	"dns": [ "8.8.8.8", "x.x.x.x" ]
}

# Restart docker service
$ sudo systemctl restart docker

Docker storage driver

If you are using the 'aufs' storage driver, you should change it to 'overlay2'

# Check current storage driver
$ docker info | grep Storage
Storage Driver: aufs

# Change aufs to overlay2
$ sudo vi /etc/docker/daemon.json
{
	...,
	"storage-driver": "overlay2"
}

# Restart docker service
$ sudo systemctl restart docker

# Check storage driver
$ docker info | grep Storage
Storage Driver: overlay2

Building the image manually.

  1. Download
$ git clone https://github.com/webispy/docker-artik-devenv.git
  1. Optional: Install custom certificates
  • To install custom certificates to an image, you must copy the .crt files to the /certs path before using the 'docker build' command.
$ cp my.crt docker-artik-devenv/certs/
  1. Build
  • Without proxy environment
$ docker build docker-artik-devenv -t artik_devenv
$ docker image ls
REPOSITORY              TAG                   IMAGE ID            CREATED              SIZE
artik_devenv            latest                441de749b491        About a minute ago   1.65GB
...
  • With proxy environment
$ docker build --build-arg http_proxy=http://x.x.x.x:port --build-arg https_proxy=http://x.x.x.x:port docker-artik-devenv -t artik_devenv

$ docker image ls
REPOSITORY              TAG                   IMAGE ID            CREATED              SIZE
artik_devenv            latest                441de749b491        About a minute ago   1.65GB
...

Run

  • You can use manually build image('artik_devenv') or downloaded image('webispy/artik_devenv')
  • "--name" option: create container with name 'haha'

Without X11

  • Share some files with host (/dev/bus/usb and ~/.ssh)
$ docker run -it -v /dev/bus/usb:/dev/bus/usb -v ~/.ssh:/home/work/.ssh --privileged --name haha artik_devenv
➜  ~~ exit

With X11

  • Set DISPLAY environment variable
  • Share /tmp/.X11-unix
$ docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /dev/bus/usb:/dev/bus/usb -v ~/.ssh:/home/work/.ssh --privileged artik_devenv
➜  ~~ sudo apt install xterm
➜  ~ xterm

Reuse the container

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                          PORTS               NAMES
6e2d2bbbc3a2        artik_devenv        "zsh"               About a minute ago   Exited (0) About a minute ago                       haha

$ docker start haha
$ docker attach haha
➜  ~

Usage

TizenRT for ARTIK-05x

# Start container
$ docker run -it --privileged -v /dev/bus/usb:/dev/bus/usb webispy/artik_devenv

➜  ~ git clone https://github.com/SamsungARTIK/TizenRT.git
➜  ~ cd TizenRT/os/tools
➜  tools git:(artik) ./configure.sh artik053/nettest
➜  tools git:(artik) cd ..
➜  os git:(artik) make
➜  os git:(artik) sudo make download os

RPM build for ARTIK 520/710

# Start container
$ docker run -it --privileged webispy/artik_devenv

# Download latest rootfs~ wget https://github.com/SamsungARTIK/fedora-spin-kickstarts/releases/download/release%2FA710_os_2.2.0/fedora-arm-artik710-rootfs-0710GC0F-44F-01QC-20170713.175433-f63a17cbfdaffd3385f23ea12388999a.tar.gz

# Initialize environment using rootfs~ fed-artik-host-init-buildsys -I fedora-arm-artik710-rootfs-0710GC0F-44F-01QC-20170713.175433-f63a17cbfdaffd3385f23ea12388999a.tar.gz

# Initialize chroot environment (It takes a long time...)~ fed-artik-init-buildsys

# Now build your package~ cd my_pkg
➜  my_pkg:(master) fed-artik-build

You can use a webispy/artik_devenv_f710 image that has completed the fed-artik-tools setup process above.

DEB build for ARTIK 530(armhf)/710(arm64)

# Start container
$ docker run -it --privileged -v /var/lib/chroots webispy/artik_devenv

# Create armhf native environment~ mk-sbuild --arch armhf xenial

# Now build your package~ git clone https://github.com/xxxx
➜  ~ cd xxxx
➜  xxxx ~ sbuild --chroot xenial-armhf --arch armhf -j8

# Tips. Start a root session that makes persistent changes~ schroot --chroot source:xenial-armhf --user root

You can use a webispy/artik_devenv_u710 image that has completed the mk-sbuild setup process above.

Docker tips

Image management

$ docker image ls
$ docker image rm xxxxx

Container management

$ docker ps -a
$ docker ps rm xxxxx
$ docker restart xxxxx
$ docker exec xxxxx {command}

License

The MIT License

Copyright (c) 2017 Inho Oh [email protected]

docker-artik-devenv's People

Contributors

webispy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.