|
| 1 | +################################################################################ |
| 2 | +# CORE Dockerfile |
| 3 | +# MAINTAINER airstack team <support@airstack.io> |
| 4 | +# |
| 5 | +# Conventions: |
| 6 | +# |
| 7 | +# RUN |
| 8 | +# - single command on one line |
| 9 | +# - multiple commands: |
| 10 | +# - `set -e; \` on first line |
| 11 | +# - separate commands on subsequent lines, each ending with `; \` |
| 12 | +# |
| 13 | +# |
| 14 | +################################################################################ |
| 15 | + |
| 16 | +FROM debian:wheezy |
| 17 | +RUN echo "deb http://http.debian.net/debian wheezy-backports main" >> /etc/apt/sources.list |
| 18 | + |
| 19 | +USER root |
| 20 | +ENV HOME /root |
| 21 | +WORKDIR /root |
| 22 | +RUN set -e; \ |
| 23 | + groupadd --system airstack --gid 432; \ |
| 24 | + useradd --uid 431 --system --base-dir /home --create-home --gid airstack --shell /bin/nologin --comment "airstack user" airstack; \ |
| 25 | + chown -R airstack:airstack /home/airstack |
| 26 | +################################################################################ |
| 27 | +# PACKAGES |
| 28 | +# |
| 29 | +# Add commands required for installing packages. To minimize rebuilds, binaries |
| 30 | +# that are modified less often should be in earlier RUN commands. |
| 31 | +# |
| 32 | +# Conventions: |
| 33 | +# |
| 34 | +# See Dockerfile.base conventions. |
| 35 | +# |
| 36 | +# Packages |
| 37 | +# - use core helper functions to install packages |
| 38 | +# - /command/core-package-install |
| 39 | +# - put development packages in Dockerfile.packages.development |
| 40 | +# - reserve this file for common packages only |
| 41 | +# - install packages to /package |
| 42 | +# - symlink commands in /package to /usr/bin or /usr/local/bin |
| 43 | +# |
| 44 | +################################################################################ |
| 45 | + |
| 46 | +COPY core/build/ /package/airstack-0.1.0/build |
| 47 | +RUN set -e; \ |
| 48 | + ln -s /package/airstack-0.1.0 /package/airstack; \ |
| 49 | + chmod -R 1755 /package; \ |
| 50 | + mkdir /command; \ |
| 51 | + ln -s /package/airstack/build/core-* /command/ |
| 52 | + |
| 53 | +# Packages::Base |
| 54 | +RUN set -e; \ |
| 55 | + /command/core-package-install wget ca-certificates libssl1.0.0 libpcre3 openssl; \ |
| 56 | + /command/core-slashpackage-install jq-1.4 |
| 57 | + |
| 58 | +# Packages::runit |
| 59 | +RUN touch /etc/inittab && /command/core-package-install runit |
| 60 | + |
| 61 | +# Packages::socklog |
| 62 | +RUN /command/core-package-install socklog ipsvd netcat-openbsd |
| 63 | + |
| 64 | +# Packages::dropbear |
| 65 | +RUN /command/core-package-install dropbear |
| 66 | + |
| 67 | +# Packages::Lua |
| 68 | +RUN set -e; \ |
| 69 | + /command/core-package-install luajit lua-posix; \ |
| 70 | + mkdir -p /usr/local/share/lua/5.1; \ |
| 71 | + ln -s /usr/bin/luajit /usr/bin/lua; \ |
| 72 | + ln -s /package/airstack/core/lua/airstack.lua /usr/local/share/lua/5.1/airstack.lua |
| 73 | +################################################################################ |
| 74 | +# PACKAGES: DEVELOPMENT |
| 75 | +# |
| 76 | +# Add development packages here. |
| 77 | +################################################################################ |
| 78 | + |
| 79 | +RUN set -e; \ |
| 80 | + /command/core-package-install \ |
| 81 | + ethtool net-tools \ |
| 82 | + procps psmisc bwm-ng \ |
| 83 | + sudo \ |
| 84 | + man-db info \ |
| 85 | + wget curl \ |
| 86 | + inotify-tools \ |
| 87 | + less vim-tiny; \ |
| 88 | + ln -s /usr/bin/vim.tiny /usr/bin/vim |
| 89 | + |
| 90 | +RUN set -e; \ |
| 91 | + /command/core-package-install \ |
| 92 | + make bzip2 |
| 93 | +################################################################################ |
| 94 | +# SERVICES |
| 95 | +# |
| 96 | +# Add commands for configuring and managing services. |
| 97 | +# |
| 98 | +# Conventions: |
| 99 | +# |
| 100 | +# - do not install any packages in this file |
| 101 | +# - keep this file minimal to ensure faster rebuilds |
| 102 | +# |
| 103 | +################################################################################ |
| 104 | + |
| 105 | +COPY core /package/airstack/core |
| 106 | +RUN ln -s /package/airstack/core/command/core-* /command/ |
| 107 | + |
| 108 | +# socklog |
| 109 | +COPY services/socklog-unix /package/airstack/socklog-unix |
| 110 | + |
| 111 | +# runit |
| 112 | +COPY services/runit /package/airstack/runit |
| 113 | +RUN /package/airstack/runit/enable |
| 114 | + |
| 115 | +# dropbear |
| 116 | +COPY services/dropbear /package/airstack/dropbear |
| 117 | +EXPOSE 22 |
| 118 | +################################################################################ |
| 119 | +# SERVICES: DEVELOPMENT |
| 120 | +################################################################################ |
| 121 | + |
| 122 | +# Password-less sudo enabled for airstack user |
| 123 | +RUN set -e; \ |
| 124 | + echo "airstack ALL = NOPASSWD: ALL" > /etc/sudoers.d/airstack; \ |
| 125 | + usermod --shell /bin/bash airstack |
0 commit comments