1 Star 0 Fork 105

studentuse/jsnes

forked from dafeiyu/jsnes 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 2.83 KB
一键复制 编辑 原始数据 按行查看 历史
ben.wangz 提交于 2022-06-28 08:16 . !2 增加容器化、文档站点化
buildscript {
repositories {
maven { url("https://maven.aliyun.com/repository/public") }
maven { url("https://maven.aliyun.com/repository/spring") }
maven { url("https://maven.aliyun.com/repository/mapr-public") }
maven { url("https://maven.aliyun.com/repository/spring-plugin") }
maven { url("https://maven.aliyun.com/repository/gradle-plugin") }
maven { url("https://maven.aliyun.com/repository/google") }
maven { url("https://maven.aliyun.com/repository/jcenter") }
}
}
plugins {
id "de.undercouch.download" version "4.1.1"
}
def mainVersion = "1.0.0"
Map<String, String> envMap = new HashMap<>(System.getenv())
def imageRepository = envMap.getOrDefault("IMAGE_REPOSITORY ", "wangz2019/jsnes")
String imageWithTag = "${imageRepository}:${mainVersion}"
File runtimeDockerDirectory = project.file("${project.buildDir}/runtime/docker")
task buildDockerImage() {
doFirst {
runtimeDockerDirectory.mkdirs()
runtimeDockerDirectory.delete()
copy {
from project.file("docker")
into runtimeDockerDirectory
}
copy {
from project.file("lib")
into "${runtimeDockerDirectory}/lib"
}
copy {
from project.file("src")
into "${runtimeDockerDirectory}/src"
}
copy {
from project.file("roms")
into "${runtimeDockerDirectory}/roms"
}
}
doLast {
exec {
commandLine(
"docker", "build",
"--rm",
"-f", project.file("${runtimeDockerDirectory.getAbsolutePath()}/Dockerfile"),
"-t", imageWithTag,
runtimeDockerDirectory,
)
}
}
}
task pushDockerImage() {
doLast {
exec {
commandLine(
"docker", "buildx", "build",
"--platform", "linux/amd64,linux/arm64,linux/arm/v7",
"--rm",
"-f", project.file("${runtimeDockerDirectory.getAbsolutePath()}/Dockerfile"),
"-t", imageWithTag,
"--push",
runtimeDockerDirectory,
)
}
}
dependsOn(buildDockerImage)
}
def containerName = "jsnes"
def port = 8081
task runDockerContainer(type: Exec) {
doFirst {
println("running command: ${String.join(" ", getCommandLine())}")
}
executable("docker")
args(
"run", "--rm",
"-p", "${port}:80",
"--name", containerName,
"-d", imageWithTag,
)
doLast {
println("visit http://localhost:${port}")
}
}
task stopDockerContainer(type: Exec) {
executable("docker")
args(
"stop", containerName
)
}
apply from: project.file("docs.nginx.gradle")
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
HTML
1
https://gitee.com/studentuse/jsnes.git
git@gitee.com:studentuse/jsnes.git
studentuse
jsnes
jsnes
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385