From aba86f5439f9470fe5a10cd39e625cfed044dfd7 Mon Sep 17 00:00:00 2001
From: Kevin Lyda <kevin@ie.suberic.net>
Date: Tue, 2 May 2017 10:20:36 +0100
Subject: [PATCH] Port to docker.

---
 Dockerfile  | 10 ++++++++
 README.md   | 71 ++++++-----------------------------------------------
 Vagrantfile | 37 ----------------------------
 app/init    | 17 +++++++++++++
 4 files changed, 35 insertions(+), 100 deletions(-)
 create mode 100644 Dockerfile
 delete mode 100644 Vagrantfile
 create mode 100755 app/init

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..6c4c5cd
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,10 @@
+FROM ubuntu:16.04
+LABEL maintainer="Kevin Lyda <lyda@gitlab.com>"
+
+EXPOSE 80 22
+
+RUN DEBIAN_FRONTEND=noninteractive \
+    apt-get install curl openssh-server ca-certificates postfix
+ADD app /app
+
+ENTRYPOINT ["/app/init"]
diff --git a/README.md b/README.md
index 206abac..23be9b8 100644
--- a/README.md
+++ b/README.md
@@ -1,70 +1,15 @@
-# Omnibus-Vagrant
+# Omnibus-Docker
 
-#### Requirements:
-[Virtualbox 5.1+](https://www.virtualbox.org/wiki/Downloads)
+## Requirements
 
-[Vagrant 1.9+](https://www.vagrantup.com/downloads.html)
+A functioning docker install - locally or remotely.
 
-#### Configure
+## Create Image
 
-
-Data file gitlab-vagrant.yml contains profiles for each of your vagrant machines.  
-
-Name can be any parseable format, such as:
-
-- gitlab-edition-version
-- gitlab-ticket-number
-- gitlab-date
-
-Example:
-
-```
----
-- name: gitlab-ee-latest
-  version: 9.1.1
-  edition: ee
-  host_port: 9110
-
-- name: gitlab-ce-12345
-  version: 8.17.3
-  edition: ce
-  host_port: 8173
+```bash
+docker build -t omnibus-docker
 ```
 
-Make changes to this file and save.
-
-For the following steps change name to the name of the machine in your profile, i.e. gitlab-ee-12345.
-
-#### Provision
-
-`vagrant up name`
-
-#### Status
-
-Show all running machines:
-
-`vagrant global-status`
-
-Show status of specific machine:
-
-`vagrant status name`
-
-#### Connect via SSH
-
-`vagrant ssh name`
-
-#### Stop
-
-`vagrant stop name`
-
-#### Cleanup
-
-Once you are finished with the VM you can remove it with:
-
-`vagrant destroy name`
-
-#### Reprovision
-
-To reprovision an existing machine:
+## Create container
 
-`vagrant up name --provision`
+docker run -ti --rm -e EDITION=ce VERSION=9.1.2 omnibus-docker
diff --git a/Vagrantfile b/Vagrantfile
deleted file mode 100644
index 85be6ac..0000000
--- a/Vagrantfile
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- mode: ruby -*-
-# vi: set ft=ruby :
-
-# Specify minimum Vagrant version and Vagrant API version
-Vagrant.require_version ">= 1.6.0"
-#VAGRANTFILE_API_VERSION = "2"
- 
-# Require YAML module
-require 'yaml'
-
-gitlab_vagrant = YAML.load_file('gitlab-vagrant.yml')
-
-Vagrant.configure("2") do |config|
-  gitlab_vagrant.each do |gitlab_vagrant|
-
-    name = gitlab_vagrant["name"]
-    version = gitlab_vagrant["version"]
-    edition = gitlab_vagrant["edition"]
-    host_port = gitlab_vagrant["host_port"]
-
-    config.vm.define name do |provision|
-      config.vm.box = "ubuntu/xenial64"
-      config.vm.network "forwarded_port", guest: 80, host: host_port,
-        auto_correct: true
-      config.vm.provider "virtualbox" do |vb|
-         vb.memory = "4096"
-      end
-  
-      config.vm.provision "shell", inline: <<-SHELL
-         sudo DEBIAN_FRONTEND=noninteractive apt-get install curl openssh-server ca-certificates postfix
-         curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-#{edition}/script.deb.sh | sudo bash
-         sudo apt-get install gitlab-#{edition}=#{version}-#{edition}.0
-         sudo gitlab-ctl reconfigure
-      SHELL
-    end
-  end
-end
diff --git a/app/init b/app/init
new file mode 100755
index 0000000..3a543d3
--- /dev/null
+++ b/app/init
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+base_url=https://packages.gitlab.com/install/repositories/gitlab/gitlab-
+
+if [[ -z "$EDITION" || -z "$VERSION" ]]; then
+  cat << EOF
+ERROR: must set EDITION and VERSION.
+       EDITION can be "ce" or "ee"
+       VERSION might be 9.1.2
+EOF
+  exit 1
+fi
+
+curl -s $base_url$EDITION/script.deb.sh | bash
+apt-get install gitlab-${EDITION}=${VERSION}-${EDITION}.0
+gitlab-ctl reconfigure
+exec bash
-- 
GitLab