Skip to content

Commit

Permalink
Moved default env variables to entrypoint. (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
wgrzelak authored Jan 21, 2019
1 parent 785a2f8 commit 51b947d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 3 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ FROM gcr.io/google-appengine/debian9:latest

ENV PACKER_VERSION 1.0.0
ENV PACKER_SHA256 ed697ace39f8bb7bf6ccd78e21b2075f53c0f23cdfb5276c380a053a7b906853

ENV PACKER_BINARY /bin/packer

ENV CHEF_DIR /chef
ENV PACKER_DIR /packer/templates
ENV TESTS_DIR /tests

ENV KEY_FILE_PATH /service-account.json
ENV USE_INTERNAL_IP false

ENV RUN_TESTS false
ENV ATTACH_LICENSE false

# Installs packages
RUN set -eux \
Expand Down Expand Up @@ -55,9 +49,9 @@ RUN set -eux \
# Unzips binary
&& unzip "packer_${PACKER_VERSION}_linux_amd64.zip" \
&& rm "packer_${PACKER_VERSION}_linux_amd64.zip" \
# Copies binary
&& mv packer /bin/packer \
&& chmod +x /bin/packer \
# Moves binary
&& mv packer ${PACKER_BINARY} \
&& chmod +x ${PACKER_BINARY} \
# Downloads source code
&& curl -L -o packer.tar.gz "https://github.com/hashicorp/packer/archive/v${PACKER_VERSION}.tar.gz" \
&& mkdir -p /usr/local/src/packer \
Expand Down
9 changes: 6 additions & 3 deletions scripts/build-vm-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,20 @@ function _register_gcloud_config() {
gcloud info
}

# Print environment variables.
env

# Register a new gcloud configuration.
_register_gcloud_config

# Set default value for unset variables.
# :: These variables are readonly wide.
readonly RUN_TESTS="${RUN_TESTS:-true}"
readonly ATTACH_LICENSE="${ATTACH_LICENSE:-true}"
readonly RUN_TESTS="${RUN_TESTS:-false}"
readonly ATTACH_LICENSE="${ATTACH_LICENSE:-false}"
readonly IMAGE_NAME="${IMAGE_NAME:-${SOLUTION_NAME}-v$(($(date +%s%N)/1000000))}"
# :: These variables are export wide.
export ZONE="${ZONE:-us-central1-f}"
export USE_INTERNAL_IP="${USE_INTERNAL_IP:-true}"
export USE_INTERNAL_IP="${USE_INTERNAL_IP:-false}"

# Set helpful variables.
# :: These variables are readonly wide.
Expand Down

0 comments on commit 51b947d

Please sign in to comment.