Skip to content

Commit

Permalink
Merge pull request #1413 from ttomsu/google-slim-container
Browse files Browse the repository at this point in the history
Slims container by deleting compile-time requirements.
  • Loading branch information
Travis Tomsu authored Feb 3, 2017
2 parents 5ebea9b + 6479802 commit 3e5cce1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ COPY . workdir/

WORKDIR workdir

RUN GRADLE_USER_HOME=cache ./gradlew buildDeb -x test

RUN dpkg -i ./clouddriver-web/build/distributions/*.deb
RUN GRADLE_USER_HOME=cache ./gradlew buildDeb -x test && \
dpkg -i ./clouddriver-web/build/distributions/*.deb && \
cd .. && \
rm -rf workdir

CMD ["/opt/clouddriver/bin/clouddriver"]
12 changes: 12 additions & 0 deletions Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM openjdk:8u111-jre-alpine

MAINTAINER [email protected]

COPY ./clouddriver-web/build/distributions/clouddriver.zip /opt/clouddriver.zip

RUN apk add --update bash && \
unzip /opt/clouddriver.zip -d /opt && \
rm /opt/clouddriver.zip && \
rm -rf /var/cache/apk/*

CMD ["/opt/clouddriver/bin/clouddriver"]
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ buildscript {
repositories {
jcenter()
maven { url "http://spinnaker.bintray.com/gradle" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.netflix.spinnaker.gradle:spinnaker-gradle-project:3.10.0'
classpath 'com.netflix.spinnaker.gradle:spinnaker-gradle-project:3.11.0'
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
}
}
Expand Down
11 changes: 11 additions & 0 deletions cloudbuild.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
steps:
- name: 'gcr.io/cloud-builders/git'
args: ['fetch', '--unshallow']
- name: 'java:8'
env: ["GRADLE_USER_HOME=cache"]
entrypoint: "bash"
args: [ "-c", "./gradlew clouddriver-web:distZip -x test"]
- name: 'gcr.io/cloud-builders/docker'
args: ["build", "-t", "gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA", "-f", "Dockerfile.slim", "."]
images:
- 'gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA'

0 comments on commit 3e5cce1

Please sign in to comment.