This commit is contained in:
Jackson Delahunt 2019-02-28 20:19:22 +11:00
parent 4ab82445e6
commit 03675e8e4c
2 changed files with 15 additions and 31 deletions

View file

@ -1,20 +0,0 @@
REPO_ROOT=$(dirname $(realpath $0))/..
# Export desktop environment shell configuration
export $($REPO_ROOT/docker/scripts/environment.sh)
# Authenticate with cloud service provider
$REPO_ROOT/credentials/authenticate.sh
docker run \
--env DESKTOP_ENVIRONMENT_CONTAINER \
--env DESKTOP_ENVIRONMENT_REGISTRY \
--env GOOGLE_APPLICATION_CREDENTIALS=$DESKTOP_ENVIRONMENT_HOST_REPOSITORY/credentials/google.json \
--interactive \
--rm \
--tty \
--volume $DESKTOP_ENVIRONMENT_HOST_REPOSITORY:$DESKTOP_ENVIRONMENT_HOST_REPOSITORY \
--workdir $DESKTOP_ENVIRONMENT_HOST_REPOSITORY \
hashicorp/packer:light build \
-force \
desktop-environment.json

View file

@ -1,28 +1,32 @@
{
"builders": [
{
"type": "googlecompute",
"source_image_family": "ubuntu-minimal-1810",
"project_id": "stemnapp",
"zone": "australia-southeast1-a",
"instance_name": "packer-{{user `DESKTOP_ENVIRONMENT_REGISTRY`}}-{{user `DESKTOP_ENVIRONMENT_CONTAINER`}}-{{timestamp}}",
"image_name": "{{user `DESKTOP_ENVIRONMENT_REGISTRY`}}-{{user `DESKTOP_ENVIRONMENT_CONTAINER`}}",
"ssh_username": "root"
"instance_name": "packer-{{user `DESKTOP_ENVIRONMENT_REGISTRY`}}-{{user `DESKTOP_ENVIRONMENT_CONTAINER`}}-{{timestamp}}",
"project_id": "stemnapp",
"source_image_family": "ubuntu-minimal-1810",
"ssh_username": "root",
"type": "googlecompute",
"zone": "australia-southeast1-a"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"# Install git",
"apt-get update -qq && apt-get install -qq git",
"# Clone the desktop environment",
"git clone https://github.com/{{user `DESKTOP_ENVIRONMENT_REGISTRY`}}/{{user `DESKTOP_ENVIRONMENT_CONTAINER`}}",
"# Prepare the desktop environment host",
"{{user `DESKTOP_ENVIRONMENT_CONTAINER`}}/host/bootstrap.sh --xpra"
]
],
"type": "shell"
}
]
],
"variables": {
"DESKTOP_ENVIRONMENT_CONTAINER": "{{env `DESKTOP_ENVIRONMENT_CONTAINER`}}",
"DESKTOP_ENVIRONMENT_REGISTRY": "{{env `DESKTOP_ENVIRONMENT_REGISTRY`}}"
}
}