diff --git a/.dockerignore b/.dockerignore index 49dc76f..8e071a0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,3 @@ -make.sh +* +!requirements.txt +!flask_control.py diff --git a/Dockerfile b/Dockerfile index c64d236..3a483b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,18 @@ FROM golang:1.10.1-alpine3.7 -RUN apk add --no-cache build-base git linux-headers python python-dev py-pip py-setuptools +ARG GOVMOMI_CHECKOUT=dee49fa3694c5aff05e4b340b0686772f65c1fe1 ADD requirements.txt /root/requirements.txt -RUN pip install -r /root/requirements.txt -ADD flask_control.py /root/flask_control.py -RUN go get -d github.com/vmware/govmomi && \ +RUN apk add --no-cache build-base git linux-headers python python-dev py-pip py-setuptools && \ + pip install -r /root/requirements.txt && \ + go get -d github.com/vmware/govmomi && \ cd ${GOPATH}/src/github.com/vmware/govmomi && \ - git checkout dee49fa3694c5aff05e4b340b0686772f65c1fe1 && \ - go install github.com/vmware/govmomi/govc github.com/vmware/govmomi/vcsim + git checkout ${GOVMOMI_CHECKOUT} && \ + go install github.com/vmware/govmomi/govc github.com/vmware/govmomi/vcsim && \ + apk del build-base git linux-headers python-dev py-pip py-setuptools + +ADD flask_control.py /root/flask_control.py EXPOSE 5000 8989 443 80 8080 CMD ["/root/flask_control.py"] diff --git a/README.md b/README.md index 2ffeb17..3d7fe4b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,16 @@ # vcenter-test-container vCenter simulator container for testing. + +## Usage ## + +### Building the image locally ### + +```bash +docker image build -t local/ansible/vcenter-test-container:latest . +``` + +### Building the image locally with a different version of govmomi checked out ### + +```bash +docker image build --build-arg GOVMOMI_CHECKOUT= -t local/ansible/vcenter-test-container: . +``` diff --git a/make.sh b/make.sh deleted file mode 100755 index 589d949..0000000 --- a/make.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker build --no-cache -t ansible:vcenter-simulator .