#!/bin/sh

# Create a scratch-like image that contains data/directories the agent expects
# to exist. Currently there are no directories actually required here.
# Potentially the '/data' directory could be included, but it's desireable to
# fail fast when that directory doesn't exist so not including it forces it to
# be volume mounted.
# TODO, move the cert-inclusion process into this step

mkdir amazon-ecs-scratch # include other directories that are needed here
mkdir amazon-ecs-scratch/tmp
mkdir amazon-ecs-scratch/images
mkdir amazon-ecs-scratch/amazon-ecs-cni-plugins

cd amazon-ecs-scratch
tar -cv . | docker import - "amazon/amazon-ecs-scratch:make"
cd ..
rmdir amazon-ecs-scratch/tmp amazon-ecs-scratch/images amazon-ecs-scratch/amazon-ecs-cni-plugins amazon-ecs-scratch
