Skip to content

Commit

Permalink
RDB Loader: build Docker image (close #247)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuwy committed Jan 19, 2021
1 parent 8b0ce82 commit 947f39c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/deploy_loader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,18 @@ jobs:
with:
packages: |
release-manager
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build and publish Loader
java-version: 11
- name: Docker login
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and publish RDB Loader Docker image
run: sbt "project loader" docker:publish
- name: Build and publish Loader on S3
run: .github/deploy.sh rdb_loader $GITHUB_REF
env:
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11
- name: Run tests
run: sbt coverage test coverageReport
- name: Aggregate coverage data
Expand Down
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ lazy val common = project.in(file("modules/common"))
lazy val loader = project.in(file("modules/loader"))
.settings(
name := "snowplow-rdb-loader",
packageName in Docker := "snowplow/snowplow-rdb-loader",
initialCommands := "import com.snowplowanalytics.snowplow.rdbloader._",
Compile / mainClass := Some("com.snowplowanalytics.snowplow.rdbloader.Main")
)
.settings(BuildSettings.buildSettings)
.settings(BuildSettings.scalifySettings(shredder / name, shredder / version))
.settings(BuildSettings.assemblySettings)
.settings(BuildSettings.dockerSettings)
.settings(resolvers ++= Dependencies.resolutionRepos)
.settings(
addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"),
Expand Down Expand Up @@ -77,6 +79,7 @@ lazy val loader = project.in(file("modules/loader"))
)
)
.dependsOn(common)
.enablePlugins(JavaAppPackaging, DockerPlugin)

lazy val shredder = project.in(file("modules/shredder"))
.settings(
Expand Down
21 changes: 16 additions & 5 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ import Keys._
import sbtassembly._
import sbtassembly.AssemblyKeys._

// sbt-native-packager
import com.typesafe.sbt.packager.Keys.{daemonUser, maintainer}
import com.typesafe.sbt.packager.linux.LinuxPlugin.autoImport._
import com.typesafe.sbt.packager.docker.DockerPlugin.autoImport._
import com.typesafe.sbt.packager.docker.DockerVersion

import scoverage.ScoverageKeys._

// DynamoDB Local
Expand All @@ -42,11 +48,6 @@ object BuildSettings {
"-encoding", "UTF-8"
),

javacOptions := Seq(
"-source", "1.8",
"-target", "1.8"
),

addCompilerPlugin("org.spire-math" % "kind-projector" % "0.9.10" cross CrossVersion.binary)
)

Expand Down Expand Up @@ -152,4 +153,14 @@ object BuildSettings {
testOnly in Test := (testOnly in Test).dependsOn(startDynamoDBLocal).evaluated,
testOptions in Test += dynamoDBLocalTestCleanup.value
)

lazy val dockerSettings = Seq(
maintainer in Docker := "Snowplow Analytics Ltd. <[email protected]>",
dockerBaseImage := "snowplow-docker-registry.bintray.io/snowplow/base-debian:0.2.1",
daemonUser in Docker := "snowplow",
dockerUpdateLatest := true,
dockerVersion := Some(DockerVersion(18, 9, 0, Some("ce"))),
daemonUserUid in Docker := None,
defaultLinuxInstallLocation in Docker := "/home/snowplow" // must be home directory of daemonUser
)
}
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ addSbtPlugin("com.localytics" % "sbt-dynamodb" % "2.0.3")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.14")
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.7.6")

0 comments on commit 947f39c

Please sign in to comment.