Skip to content

Commit

Permalink
fix(build): docker build (#578)
Browse files Browse the repository at this point in the history
* fix(build): docker build

* feat(build): docker compose standalone kayenta

* chore(build): remove dist tar

* refactor(build): unpack in builder image
  • Loading branch information
jmccann authored and cfieber committed Jul 17, 2019
1 parent 22cef9f commit def3fcc
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Dockerfile
build/
docker-compose.yaml
.git/
32 changes: 24 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
FROM openjdk:8
#
# Builder Image
#
FROM gradle:5.4-jdk8 AS builder

MAINTAINER delivery-engineering@netflix.com
# Prep build environment
ENV GRADLE_USER_HOME=cache
COPY . /tmp/workdir
WORKDIR /tmp/workdir

# Build kayenta
RUN gradle build

# Unpack so release image can copy folder and be smaller
RUN tar -xf /tmp/workdir/kayenta-web/build/distributions/kayenta.tar -C /opt

COPY . workdir/
#
# Release Image
#
FROM openjdk:8-alpine

MAINTAINER delivery-engineering@netflix.com

WORKDIR workdir
# Set where to look for config from
ENV KAYENTA_OPTS=-Dspring.config.location=file:/opt/kayenta/config/kayenta.yml

RUN GRADLE_USER_HOME=cache ./gradlew -I gradle/init-publish.gradle buildDeb -x test && \
dpkg -i ./kayenta-web/build/distributions/*.deb && \
cd .. && \
rm -rf workdir
# Copy from builder image
COPY --from=builder /opt/kayenta /opt/kayenta

CMD ["/opt/kayenta/bin/kayenta"]
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ To start the JVM in debug mode, set the Java system property `DEBUG=true`:
The JVM will then listen for a debugger to be attached on port 8191. The JVM will _not_ wait for the debugger
to be attached before starting Kayenta; the relevant JVM arguments can be seen and modified as needed in `build.gradle`.

### Running Standalone Kayenta Locally

You can run a standalone kayenta instance locally with docker compose.

```
# Copy and edit example config to edit to your needs
cp kayenta-web/config/kayenta.yml ~/.spinnaker/kayenta.yml
# Build/Start Kayenta
docker-compose up
```

You should then be able to access your local kayenta instance at http://localhost:8090/swagger-ui.html
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.7"
services:
redis:
image: redis:latest
kayenta:
build: .
ports:
- 8090:8090
volumes:
- "~/.spinnaker/kayenta.yml:/opt/kayenta/config/kayenta.yml"
depends_on:
- redis

0 comments on commit def3fcc

Please sign in to comment.