Merge pull request #134 from resin-io/alpine

Add alpine supervisor build info
This commit is contained in:
Pablo Carranza Vélez 2016-05-18 11:59:32 -03:00
commit ebf2c04a08
8 changed files with 228 additions and 38 deletions

39
Dockerfile.alpine.amd64 Normal file
View File

@ -0,0 +1,39 @@
FROM resin/amd64-alpine-node:0.10.44-slim
# Supervisor apt dependencies
RUN apk add --update \
btrfs-progs \
ca-certificates \
rsync \
supervisor \
&& rm -rf /var/cache/apk/*
# Copy supervisord configuration files
COPY config/supervisor/ /etc/supervisor/
# Install dependencies
WORKDIR /app
COPY package.json postinstall.sh /app/
RUN set -x \
&& buildDeps='g++ sqlite-dev sqlite-libs make' \
&& apk add --update $buildDeps \
&& JOBS=MAX npm install --unsafe-perm --production --no-optional --build-from-source \
&& npm dedupe \
&& npm cache clean \
&& rm -rf /tmp/* \
&& apk del $buildDeps \
&& rm -rf /var/cache/apk/*
# Copy source
COPY . /app/
RUN /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.alpine.sh /start # Needed for legacy
RUN chmod +x /app/bin/gosuper
ENV SUPERVISOR_IMAGE resin/amd64-alpine-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null
ENTRYPOINT ["/app/entry.alpine.sh"]

39
Dockerfile.alpine.armv7hf Normal file
View File

@ -0,0 +1,39 @@
FROM resin/armhf-alpine-node:0.10.44-slim
# Supervisor apt dependencies
RUN apk add --update \
btrfs-progs \
ca-certificates \
rsync \
supervisor \
&& rm -rf /var/cache/apk/*
# Copy supervisord configuration files
COPY config/supervisor/ /etc/supervisor/
# Install dependencies
WORKDIR /app
COPY package.json postinstall.sh /app/
RUN set -x \
&& buildDeps='g++ sqlite-dev sqlite-libs make' \
&& apk add --update $buildDeps \
&& JOBS=MAX npm install --unsafe-perm --production --no-optional --build-from-source \
&& npm dedupe \
&& npm cache clean \
&& rm -rf /tmp/* \
&& apk del $buildDeps \
&& rm -rf /var/cache/apk/*
# Copy source
COPY . /app/
RUN /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.alpine.sh /start # Needed for legacy
RUN chmod +x /app/bin/gosuper
ENV SUPERVISOR_IMAGE resin/armhf-alpine-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null
ENTRYPOINT ["/app/entry.alpine.sh"]

39
Dockerfile.alpine.i386 Normal file
View File

@ -0,0 +1,39 @@
FROM resin/i386-alpine-node:0.10.44-slim
# Supervisor apt dependencies
RUN apk add --update \
btrfs-progs \
ca-certificates \
rsync \
supervisor \
&& rm -rf /var/cache/apk/*
# Copy supervisord configuration files
COPY config/supervisor/ /etc/supervisor/
# Install dependencies
WORKDIR /app
COPY package.json postinstall.sh /app/
RUN set -x \
&& buildDeps='g++ sqlite-dev sqlite-libs make' \
&& apk add --update $buildDeps \
&& JOBS=MAX npm install --unsafe-perm --production --no-optional --build-from-source \
&& npm dedupe \
&& npm cache clean \
&& rm -rf /tmp/* \
&& apk del $buildDeps \
&& rm -rf /var/cache/apk/*
# Copy source
COPY . /app/
RUN /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.alpine.sh /start # Needed for legacy
RUN chmod +x /app/bin/gosuper
ENV SUPERVISOR_IMAGE resin/i386-alpine-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null
ENTRYPOINT ["/app/entry.alpine.sh"]

39
Dockerfile.alpine.rpi Normal file
View File

@ -0,0 +1,39 @@
FROM resin/armhf-alpine-node:0.10.44-slim
# Supervisor apt dependencies
RUN apk add --update \
btrfs-progs \
ca-certificates \
rsync \
supervisor \
&& rm -rf /var/cache/apk/*
# Copy supervisord configuration files
COPY config/supervisor/ /etc/supervisor/
# Install dependencies
WORKDIR /app
COPY package.json postinstall.sh /app/
RUN set -x \
&& buildDeps='g++ sqlite-dev sqlite-libs make' \
&& apk add --update $buildDeps \
&& JOBS=MAX npm install --unsafe-perm --production --no-optional --build-from-source \
&& npm dedupe \
&& npm cache clean \
&& rm -rf /tmp/* \
&& apk del $buildDeps \
&& rm -rf /var/cache/apk/*
# Copy source
COPY . /app/
RUN /app/node_modules/.bin/coffee -c /app/src \
&& ln -sf /app/entry.alpine.sh /start # Needed for legacy
RUN chmod +x /app/bin/gosuper
ENV SUPERVISOR_IMAGE resin/armhf-alpine-supervisor
ENV CONFIG_MOUNT_POINT /boot/config.json
ENV LED_FILE /dev/null
ENTRYPOINT ["/app/entry.alpine.sh"]

View File

@ -1,6 +1,7 @@
DISABLE_CACHE = 'false'
ARCH = rpi# rpi/amd64/i386/armv7hf/armel
BASE_DISTRO =
DEPLOY_REGISTRY =
@ -9,13 +10,22 @@ JOB_NAME = 1
all: supervisor
IMAGE = "resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION)"
SUPERVISOR_IMAGE=$(DEPLOY_REGISTRY)$(IMAGE)
PUBNUB_SUBSCRIBE_KEY = sub-c-bananas
PUBNUB_PUBLISH_KEY = pub-c-bananas
MIXPANEL_TOKEN = bananasbananas
ifdef BASE_DISTRO
$(info BASE_DISTRO SPECIFIED. START BUILDING ALPINE SUPERVISOR)
IMAGE = "resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION)-alpine"
DOCKERFILE = alpine.$(ARCH)
else
$(info BASE_DISTRO NOT SPECIFIED. START BUILDING DEBIAN SUPERVISOR)
IMAGE = "resin/$(ARCH)-supervisor:$(SUPERVISOR_VERSION)"
DOCKERFILE = $(ARCH)
endif
SUPERVISOR_IMAGE=$(DEPLOY_REGISTRY)$(IMAGE)
ifeq ($(ARCH),rpi)
GOARCH = arm
GOARM = 6
@ -60,7 +70,7 @@ stop-supervisor:
-docker rm -f --volumes resin_supervisor_1 > /dev/null || true
supervisor: gosuper
cp Dockerfile.$(ARCH) Dockerfile
cp Dockerfile.$(DOCKERFILE) Dockerfile
echo "ENV VERSION "`jq -r .version package.json` >> Dockerfile
echo "ENV DEFAULT_PUBNUB_PUBLISH_KEY $(PUBNUB_PUBLISH_KEY)" >> Dockerfile
echo "ENV DEFAULT_PUBNUB_SUBSCRIBE_KEY $(PUBNUB_SUBSCRIBE_KEY)" >> Dockerfile

View File

@ -11,36 +11,29 @@ docker pull resin/${ARCH}-supervisor:${ESCAPED_BRANCH_NAME} || docker pull resin
# Test the gosuper
make SUPERVISOR_VERSION=${VERSION} JOB_NAME=${JOB_NAME} test-gosuper
# Build the images
make SUPERVISOR_VERSION=${ESCAPED_BRANCH_NAME} \
ARCH=${ARCH} \
JOB_NAME=${JOB_NAME} \
DEPLOY_REGISTRY= \
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
MIXPANEL_TOKEN=${MIXPANEL_TOKEN} \
deploy
make SUPERVISOR_VERSION=${VERSION} \
ARCH=${ARCH} \
JOB_NAME=${JOB_NAME} \
DEPLOY_REGISTRY= \
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
MIXPANEL_TOKEN=${MIXPANEL_TOKEN} \
deploy
make SUPERVISOR_VERSION=${ESCAPED_BRANCH_NAME} \
ARCH=${ARCH} \
JOB_NAME=${JOB_NAME} \
DEPLOY_REGISTRY=registry.resinstaging.io/ \
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
MIXPANEL_TOKEN=${MIXPANEL_TOKEN} \
deploy
make SUPERVISOR_VERSION=${VERSION} \
ARCH=${ARCH} \
JOB_NAME=${JOB_NAME} \
DEPLOY_REGISTRY=registry.resinstaging.io/ \
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
MIXPANEL_TOKEN=${MIXPANEL_TOKEN} \
deploy
MAKE_ARGS="ARCH=${ARCH} \
JOB_NAME=${JOB_NAME} \
BASE_DISTRO=${BASE_DISTRO} \
PUBNUB_SUBSCRIBE_KEY=${PUBNUB_SUBSCRIBE_KEY} \
PUBNUB_PUBLISH_KEY=${PUBNUB_PUBLISH_KEY} \
MIXPANEL_TOKEN=${MIXPANEL_TOKEN}"
make ${MAKE_ARGS} \
SUPERVISOR_VERSION=${ESCAPED_BRANCH_NAME} \
DEPLOY_REGISTRY= \
deploy
make ${MAKE_ARGS} \
SUPERVISOR_VERSION=${VERSION} \
DEPLOY_REGISTRY= \
deploy
make ${MAKE_ARGS} \
SUPERVISOR_VERSION=${ESCAPED_BRANCH_NAME} \
DEPLOY_REGISTRY=registry.resinstaging.io/ \
deploy
make ${MAKE_ARGS} \
SUPERVISOR_VERSION=${VERSION} \
DEPLOY_REGISTRY=registry.resinstaging.io/ \
deploy

31
entry.alpine.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/sh
set -e
[ -d /dev/net ] ||
mkdir -p /dev/net
[ -c /dev/net/tun ] ||
mknod /dev/net/tun c 10 200
mkdir -p /var/log/supervisor && touch /var/log/supervisor/supervisord.log
mkdir -p /var/run/resin
mount -t tmpfs -o size=1m tmpfs /var/run/resin
if [ -z "$GOSUPER_SOCKET" ]; then
export GOSUPER_SOCKET=/var/run/resin/gosuper.sock
fi
if [ -z "$DOCKER_SOCKET" ]; then
export DOCKER_SOCKET=/run/docker.sock
fi
if [ -z "$HOST_PROC" ]; then
export HOST_PROC=/mnt/root/proc
fi
export DBUS_SYSTEM_BUS_ADDRESS="unix:path=/mnt/root/run/dbus/system_bus_socket"
/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
supervisorctl -c /etc/supervisor/supervisord.conf start resin-supervisor
supervisorctl -c /etc/supervisor/supervisord.conf start go-supervisor
tail -f /var/log/supervisor/supervisord.log

View File

@ -25,7 +25,7 @@
"resin-register-device": "^2.0.0",
"request-progress": "^0.3.1",
"rwlock": "^5.0.0",
"sqlite3": "~3.0.4",
"sqlite3": "3.0.9",
"typed-error": "~0.1.0"
},
"engines": {