-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathDockerfile.wolfi
71 lines (53 loc) · 2.62 KB
/
Dockerfile.wolfi
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
FROM docker.elastic.co/wolfi/jdk:openjdk-21.35-r1-dev@sha256:d7ca36452a68f28e4c4683062241e817b548844820a0ffd087451214e61eb188
USER root
# ------------------------------------------------------------------------------
# we need curl and make below, but then we remove them later
# TODO maybe we can do multi-stage to reduce layers in the final image
RUN apk update && apk add --no-cache curl=8.11.1-r0 make
# ------------------------------------------------------------------------------
# jruby install steps below have been adapted from:
# https://github.com/jruby/docker-jruby/blob/f325c86e2c2ca0bbe82f64c0aded0719372507fa/9.4/jdk21/Dockerfile
ENV JRUBY_VERSION=9.4.8.0
ENV JRUBY_SHA256=347b6692bd9c91c480a45af25ce88d77be8b6e4ac4a77bc94870f2c5b54bc929
RUN mkdir /opt/jruby \
&& curl -fSL https://repo1.maven.org/maven2/org/jruby/jruby-dist/${JRUBY_VERSION}/jruby-dist-${JRUBY_VERSION}-bin.tar.gz -o /tmp/jruby.tar.gz \
&& echo "$JRUBY_SHA256 /tmp/jruby.tar.gz" | sha256sum -c - \
&& tar -zx --strip-components=1 -f /tmp/jruby.tar.gz -C /opt/jruby \
&& rm /tmp/jruby.tar.gz
RUN mkdir -p /usr/local/bin && ln -s /opt/jruby/bin/jruby /usr/local/bin/ruby
ENV PATH=/opt/jruby/bin:$PATH
# skip installing gem documentation
RUN mkdir -p /opt/jruby/etc \
&& { \
echo 'install: --no-document'; \
echo 'update: --no-document'; \
} >> /opt/jruby/etc/gemrc
RUN gem install bundler rake net-telnet xmlrpc
# don't create ".bundle" in all our apps
ENV GEM_HOME=/usr/local/bundle
ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"
ENV PATH=$GEM_HOME/bin:$PATH
# adjust permissions of a few directories for running "gem install" as an arbitrary user
RUN mkdir -p "$GEM_HOME" && chmod 777 "$GEM_HOME"
# ------------------------------------------------------------------------------
# install the application
# TODO we should look at finding a better way to get the application artifact into
# the container image, since we are adding lots of stuff here that we do not need
# and may not want (do we need vendor/ after the make install below, for instance?),
# contributing to increased image size; for now at least we can remove `.git` (below)
COPY . /app
WORKDIR /app
# skip jenv/rbenv setup
ENV IS_DOCKER=1
RUN make clean install
# Clean up build dependencies
RUN rm -r /root/.m2
# ------------------------------------------------------------------------------
# remove now-unnecessary packages and directories
RUN apk del curl make git \
&& apk --purge del apk-tools \
&& rm -rf /app/.git
# switch back to the base image's default user when running the application
USER java
ENTRYPOINT [ "/bin/bash" ]