forked from codacy/codacy-codesniffer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
executable file
·73 lines (56 loc) · 2.27 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import com.typesafe.sbt.packager.docker.{Cmd, ExecCmd}
name := """codacy-engine-codesniffer"""
version := "1.0-SNAPSHOT"
val languageVersion = "2.11.7"
scalaVersion := languageVersion
resolvers ++= Seq(
"Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/releases"
)
libraryDependencies ++= Seq(
"com.typesafe.play" %% "play-json" % "2.3.8" withSources(),
"org.scala-lang.modules" %% "scala-xml" % "1.0.4" withSources(),
"com.codacy" %% "codacy-engine-scala-seed" % "2.7.1"
)
enablePlugins(JavaAppPackaging)
enablePlugins(DockerPlugin)
version in Docker := "1.0"
val installAll =
s"""apk --no-cache add bash curl git
|&& apk --no-cache add php php-openssl php-phar php-json php-curl php-iconv php-zlib
|&& curl -sS https://getcomposer.org/installer | php
|&& mv composer.phar /usr/bin/composer
|&& export COMPOSER_HOME=$$(pwd)/composer
|&& composer global require "squizlabs/php_codesniffer=2.9.1"
|&& ln -s $$COMPOSER_HOME/vendor/bin/phpcs /usr/bin/phpcs
|&& git clone --branch 0.10.0 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
|&& git clone https://github.com/magento/marketplace-eqp.git magentocs
|&& phpcs --config-set installed_paths $$(pwd)/wpcs,$$(pwd)/magentocs
|&& apk del curl git
|&& rm -rf /tmp/*
|&& rm -rf /var/cache/apk/*
""".stripMargin.replaceAll(System.lineSeparator(), " ")
mappings in Universal <++= (resourceDirectory in Compile) map { (resourceDir: File) =>
val src = resourceDir / "docs"
val dest = "/docs"
for {
path <- (src ***).get
if !path.isDirectory
} yield path -> path.toString.replaceFirst(src.toString, dest)
}
val dockerUser = "docker"
val dockerGroup = "docker"
daemonUser in Docker := dockerUser
daemonGroup in Docker := dockerGroup
dockerBaseImage := "develar/java"
dockerCommands := dockerCommands.value.flatMap {
case cmd@Cmd("WORKDIR", _) => List(cmd,
Cmd("RUN", installAll)
)
case cmd@(Cmd("ADD", "opt /opt")) => List(cmd,
Cmd("RUN", "mv /opt/docker/docs /docs"),
Cmd("RUN", "adduser -u 2004 -D docker"),
ExecCmd("RUN", Seq("chown", "-R", s"$dockerUser:$dockerGroup", "/docs"): _*)
)
case other => List(other)
}