-
Notifications
You must be signed in to change notification settings - Fork 17
/
Dockerfile.tmpl.erb
46 lines (46 loc) · 1.85 KB
/
Dockerfile.tmpl.erb
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
# Embedded Ruby template
# lines beginning with "#erb:" are embedded ruby lines, processing is done in Makefile so there is no syntax error in Dockerfile
# arg: arg_gem: specify a gemfile or a gem version
# arg: arg_sdk: specify a sdk file or empty (download from default url)
# cspell:ignore cliuser optipng
# Review the version of ruby to be used periodically from : https://hub.docker.com/_/ruby
FROM docker.io/ruby:3.2.2
#erb: if arg_gem.end_with?('.gem')
# For beta gem is file, then copy it
COPY <%=arg_gem%> .
# if a gem file was provided, once copied in container: use the basename only
#erb: arg_gem=File.basename(arg_gem)
#erb: end
# Install globally, does not need to be in user's home, must be outside /home/cliuser/.aspera/ascli which will be a volume
ARG sdk_install_dir=/aspera_sdk
# set SDK location in container
ENV ASCLI_SDK_FOLDER=$sdk_install_dir
#erb: unless arg_sdk.empty?
# SDK file is available locally, then copy it
COPY <%=arg_sdk%> .
# if a sdk file was provided, once copied in container: use the basename only with file url
#erb: arg_sdk='--sdk-url=file:///'+File.basename(arg_sdk)
#erb: end
# Install aspera-cli gem (beta or release), optional gems and other packages
RUN \
apt-get update && \
apt-get install -y imagemagick optipng && \
apt-get clean && \
rm -fr /var/lib/apt/lists/* && \
gem install grpc mimemagic rmagick <%=arg_gem%> && \
useradd -m -u 1000 -s /bin/bash cliuser && \
mkdir -p /home/cliuser/.aspera/ascli && \
chown -R cliuser: /home/cliuser && \
rm -f <%=arg_gem%> && \
mkdir -p $sdk_install_dir && \
chmod 755 $sdk_install_dir && \
ascli conf ascp install <%=arg_sdk%> && \
ascli conf ascp info && \
rm -f sdk.zip
# rootless execution
USER cliuser
# The default dir when starting the docker container.
WORKDIR /home/cliuser
# Install SDK, create key files and check that ascp works
ENTRYPOINT ["ascli"]
CMD ["help"]