Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Finish containerization implementation #19

Open
GigiaJ opened this issue Jun 30, 2022 · 1 comment
Open

[FEATURE] Finish containerization implementation #19

GigiaJ opened this issue Jun 30, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@GigiaJ
Copy link
Collaborator

GigiaJ commented Jun 30, 2022

Currently, the docker instructions are added, the docker file is added, and the client does run within the container, but we need to add to the Dockerfile the script directory.
Currently this is a bit of an issue since we generate the script output directory straight to the user home directory.
Docker is unable to actually view anything outside the working directory.
This means we should instead build into the standard build directory AND the script directory.
This will have to be implemented in Gradle via task that triggers on build.

@GigiaJ GigiaJ self-assigned this Jun 30, 2022
@GigiaJ GigiaJ added the enhancement New feature or request label Jun 30, 2022
@raverydavis
Copy link
Contributor

I think this can be solved via updating sourceSets and setting where to output the compile manually to /build/scripts - we already have ADD ./build/scripts root/.config/OsrsBot/Scripts/Sources/ in Dockerfile

sourceSets {
    main {
        java.getDestinationDirectory().set(file(getBotScriptDirectory(this)))
        java.getDestinationDirectory().set(file("build/scripts"))
    }
}

Alternatively we could also just do ADD ./build/libs root/.config/OsrsBot/Scripts/Precompiled/ in the Dockerfile

Updated docker gradle commands

task dockerBuild(type: Exec) {
    commandLine 'docker', 'build', '-t', 'bot-image', '.'
}

task dockerRun(dependsOn: dockerBuild, type: Exec) {
    commandLine 'docker', 'run', '-e', 'DISPLAY=host.docker.internal:0', '-t', '--rm', 'bot-image'
}

If you want to build the image and run it after every compile

compileJava {
    finalizedBy(tasks.dockerRun)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

2 participants