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

Consider alpine as a base? #1

Open
gtrak opened this issue Apr 30, 2016 · 7 comments
Open

Consider alpine as a base? #1

gtrak opened this issue Apr 30, 2016 · 7 comments

Comments

@gtrak
Copy link

gtrak commented Apr 30, 2016

It's a smaller base image than debian.

I got something going very easily:

FROM anapsix/alpine-java:jdk

# Boot
RUN wget -O /usr/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh \
    && chmod +x /usr/bin/boot

ENV BOOT_HOME /.boot
ENV BOOT_AS_ROOT yes
ENV BOOT_LOCAL_REPO /m2

# download & install deps, cache REPL and web deps
RUN /usr/bin/boot web -s doesnt/exist repl -e '(System/exit 0)' && rm -rf target
ADD . /app
WORKDIR /app
@vikeri
Copy link

vikeri commented May 31, 2016

Nice work! Have you put this up on the docker registry?

@gtrak
Copy link
Author

gtrak commented May 31, 2016

Not yet, no, should I put it somewhere?

@vikeri
Copy link

vikeri commented May 31, 2016

Actually of some reason the following line threw me an error: RUN /usr/bin/boot web -s doesnt/exist repl -e '(System/exit 0)' && rm -rf target

@gtrak
Copy link
Author

gtrak commented May 31, 2016

I just tried it again, and it worked for me. That particular line came from the existing docker boot image:

https://github.com/adzerk-oss/boot-clj-docker-image/blob/master/Dockerfile#L32

boot-alpine$ uname -a
Linux gary-stinkpad2 4.5.3-040503-generic #201605041831 SMP Wed May 4 22:33:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
boot-alpine$ docker -v
Docker version 1.11.1, build 5604cbe

boot-alpine$ docker build -t boot-alpine:latest .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM anapsix/alpine-java:jdk
jdk: Pulling from anapsix/alpine-java
d0ca440e8637: Already exists 
18536c3d5d96: Pull complete 
Digest: sha256:cb775e5d360247dd931a79bceb00072a961e6331a7ecf028f058619dc350ecc7
Status: Downloaded newer image for anapsix/alpine-java:jdk
 ---> bbe7967dec32
Step 2 : RUN wget -O /usr/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh     && chmod +x /usr/bin/boot
 ---> Running in 0e1be6059f0b
Connecting to github.com (192.30.252.129:443)
Connecting to github-cloud.s3.amazonaws.com (54.231.72.67:443)
boot                 100% |*******************************|  6431   0:00:00 ETA
 ---> e5589ff42cb2
Removing intermediate container 0e1be6059f0b
Step 3 : ENV BOOT_HOME /.boot
 ---> Running in 143c8407a184
 ---> f7cbef4d86fd
Removing intermediate container 143c8407a184
Step 4 : ENV BOOT_AS_ROOT yes
 ---> Running in d8e0cbb9cb2b
 ---> 498ba8483ebd
Removing intermediate container d8e0cbb9cb2b
Step 5 : ENV BOOT_LOCAL_REPO /m2
 ---> Running in f6abb2dc6365
 ---> 78eed5cfcfdf
Removing intermediate container f6abb2dc6365
Step 6 : RUN /usr/bin/boot web -s doesnt/exist repl -e '(System/exit 0)' && rm -rf target
 ---> Running in 2be0f9bd4fd6
Downloading https://github.com/boot-clj/boot/releases/download/2.5.2/boot.jar...
Running for the first time, BOOT_VERSION not set: updating to latest.
Retrieving boot-2.6.0.jar from https://clojars.org/repo/
Retrieving clojure-1.7.0.jar from https://repo1.maven.org/maven2/
#http://boot-clj.com
#Tue May 31 15:22:45 GMT 2016
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_VERSION=2.6.0
BOOT_CLOJURE_VERSION=1.7.0
 ---> 3dfb3ea5f821
Removing intermediate container 2be0f9bd4fd6
Step 7 : ADD . /app
 ---> 0ac47cab289e
Removing intermediate container 1d75050eabfa
Step 8 : WORKDIR /app
 ---> Running in 9ebccd6b7b03
 ---> 4c017d67a053
Removing intermediate container 9ebccd6b7b03
Successfully built 4c017d67a053
boot-alpine$ docker run --rm -it boot-alpine:latest boot
Downloading https://github.com/boot-clj/boot/releases/download/2.6.0/boot.jar...
Retrieving pod-2.6.0.pom from https://clojars.org/repo/
Retrieving dynapath-0.2.3.pom from https://clojars.org/repo/
Retrieving shimdandy-impl-1.2.0.pom from https://repo1.maven.org/maven2/ (1k)
...
Retrieving tools.namespace-0.2.11.jar from https://repo1.maven.org/maven2/ (18k)
Retrieving data.zip-0.1.1.jar from https://repo1.maven.org/maven2/ (4k)

Usage:   boot OPTS <task> TASK_OPTS <task> TASK_OPTS ...

OPTS:    -a --asset-paths PATH       Add PATH to set of asset directories.
         -b --boot-script            Print generated boot script for debugging.
         -B --no-boot-script         Ignore boot script in current directory.
         -c --checkouts SYM:VER      Add checkout dependency (eg. -c foo/bar:1.2.3).
         -C --no-colors              Remove ANSI escape codes from printed output.
         -d --dependencies SYM:VER   Add dependency to project (eg. -d foo/bar:1.2.3).
         -e --set-env KEY=VAL        Add KEY => VAL to project env map.
         -h --help                   Print basic usage and help info.
         -o --offline                Don't attempt to access remote repositories.
         -P --no-profile             Skip loading of profile.boot script.
         -r --resource-paths PATH    Add PATH to set of resource directories.
         -q --quiet                  Suppress output from boot itself.
         -s --source-paths PATH      Add PATH to set of source directories.
         -t --target-path PATH       Set the target directory to PATH.
         -T --no-target              This option is ignored.
         -u --update                 Update boot to latest release version.
         -U --update-snapshot        Update boot to latest snapshot version.
         -v --verbose                More error info (-vv more verbose, etc.)
         -V --version                Print boot version info.

Tasks:   add-repo                    Add all files in project git repo to fileset.
         aot                         Perform AOT compilation of Clojure namespaces.
         checkout                    Checkout dependencies task. DEPRECATED.
         help                        Print usage info and list available tasks.
         install                     Install project jar to local Maven repository.
         jar                         Build a jar file for the project.
         javac                       Compile java sources.
         notify                      Aural and visual notifications during build.
         pom                         Create project pom.xml file.
         push                        Deploy jar file to a Maven repository.
         repl                        Start a REPL session for the current project.
         show                        Print project/build info (e.g. dependency graph, etc).
         sift                        Transform the fileset, matching paths against regexes.
         speak                       Audible notifications during build.
         target                      Writes output files to the given directory on the filesystem.
         uber                        Add jar entries from dependencies to fileset.
         wait                        Wait before calling the next handler.
         war                         Create war file for web deployment.
         watch                       Call the next handler when source files change.
         web                         Create project web.xml file.
         zip                         Build a zip file for the project.

Env:     BOOT_AS_ROOT                Set to 'yes' to allow boot to run as root.
         BOOT_CERTIFICATES           Specify certificate file paths.
         BOOT_CLOJARS_REPO           Specify the url for the 'clojars' Maven repo.
         BOOT_CLOJARS_MIRROR         Specify the mirror url for the 'clojars' Maven repo.
         BOOT_CLOJURE_VERSION        The version of Clojure boot will provide (1.8.0).
         BOOT_CLOJURE_NAME           The artifact name of Clojure boot will provide (org.clojure/clojure).
         BOOT_COLOR                  Set to 'no' to turn colorized output off.
         BOOT_FILE                   Build script name (build.boot).
         BOOT_GPG_COMMAND            System gpg command (gpg).
         BOOT_HOME                   Directory where boot stores global state (~/.boot).
         BOOT_JAVA_COMMAND           Specify the Java executable (java).
         BOOT_JVM_OPTIONS            Specify JVM options (Unix/Linux/OSX only).
         BOOT_LOCAL_REPO             The local Maven repo path (~/.m2/repository).
         BOOT_MAVEN_CENTRAL_REPO     Specify the url for the 'maven-central' Maven repo.
         BOOT_MAVEN_CENTRAL_MIRROR   Specify the mirror url for the 'maven-central' Maven repo.
         BOOT_VERSION                Specify the version of boot core to use.
         BOOT_WARN_DEPRECATED        Set to 'no' to suppress deprecation warnings.

Files:   ./boot.properties           Specify boot options for this project.
         ./profile.boot              A script to run after the global profile.boot but before the build script.
         BOOT_HOME/boot.properties   Specify global boot options.
         BOOT_HOME/profile.boot      A script to run before running the build script.

Do `boot <task> -h` to see usage info and TASK_OPTS for <task>.

@dgellow
Copy link

dgellow commented Oct 19, 2016

@gtrak I have an error with your dockerfile

$ docker build .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM anapsix/alpine-java:jdk
jdk: Pulling from anapsix/alpine-java
e110a4a17941: Pull complete 
e4cfc81837e0: Pull complete 
Digest: sha256:47ec4416111b2427a9aabc284fa59b1096a48c707520290416d5b5b00b26a44e
Status: Downloaded newer image for anapsix/alpine-java:jdk
 ---> 8e7d41564402
Step 2 : RUN wget -O /usr/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh     && chmod +x /usr/bin/boot
 ---> Running in 1e2f25b660d5
Connecting to github.com (192.30.253.112:443)
wget: can't execute 'ssl_helper': No such file or directory
wget: error getting response: Connection reset by peer
The command '/bin/sh -c wget -O /usr/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh     && chmod +x /usr/bin/boot' returned a non-zero code: 1

@dgellow
Copy link

dgellow commented Oct 19, 2016

Ok, I now have a working version like this:

FROM anapsix/alpine-java:8_jdk

# SSL support for wget
RUN apk --no-cache add openssl

# boot-clj
RUN apk upgrade --update && \
    apk add --update
RUN wget -O /usr/bin/boot https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh \
    && chmod +x /usr/bin/boot

ENV BOOT_HOME /.boot
ENV BOOT_AS_ROOT yes
ENV BOOT_LOCAL_REPO /m2

# download & install deps, cache REPL and web deps
RUN /usr/bin/boot web -s doesnt/exist repl -e '(System/exit 0)' && rm -rf target
ADD . /app
WORKDIR /app

@dgellow
Copy link

dgellow commented Oct 19, 2016

And the image on docker hub: https://hub.docker.com/r/dgellow/alpine-boot-clj/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants