This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
forked from c9katayama/aws-lambda-jruby
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
49 lines (39 loc) · 1.79 KB
/
Dockerfile
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
FROM debian:stretch
MAINTAINER Firespring "info.dev@firespring.com"
# Add add-apt-repository
RUN apt-get update \
&& apt-get install -y software-properties-common
RUN apt-get update \
&& apt-get install default-jdk curl tar unzip -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Add JRuby
ARG JRUBY_VERSION=9.2.0.0
RUN mkdir /opt/jruby \
&& curl -fSL https://s3.amazonaws.com/jruby.org/downloads/${JRUBY_VERSION}/jruby-bin-${JRUBY_VERSION}.tar.gz -o /tmp/jruby.tar.gz \
&& tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
&& rm /tmp/jruby.tar.gz
ENV PATH /opt/jruby/bin:$PATH
RUN mkdir -p /usr/src/app/lib/ /usr/src/app/src/main/resources/ /usr/src/code/
WORKDIR /usr/src/app
# Add JRuby to the project
RUN cp /opt/jruby/lib/jruby.jar /usr/src/app/lib/jruby.jar \
&& cp -r /opt/jruby/lib/ruby/stdlib /usr/src/app/src/main/resources/ \
&& touch /usr/src/app/src/main/resources/stdlib/.jrubydir
# Add bundler to the stdlib dir in order to make it available to Java/JRuby
RUN jruby -S gem install bundle --no-ri --no-rdoc \
&& cp -r /opt/jruby/lib/ruby/gems/shared/gems/bundler*/lib/* /usr/src/app/src/main/resources/stdlib/
## Copy in the gradle project
COPY build.gradle /usr/src/app/
COPY src /usr/src/app/src
# Do a gradlew build, which also fetches gradle for the container
ARG GRADLE_VERSION=5.4.1
RUN curl -O https://downloads.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip \
&& unzip gradle-${GRADLE_VERSION}-bin.zip \
&& rm -f gradle-${GRADLE_VERSION}-bin.zip \
&& ./gradle-${GRADLE_VERSION}/bin/gradle wrapper
# Do a build just to verify the bundled files compile correctly
RUN ./gradlew build && rm -rf ./build
# Set our entrypoint
COPY entrypoint.sh /usr/src/app/entrypoint.sh
ENTRYPOINT ["/usr/src/app/entrypoint.sh"]