-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
102 lines (82 loc) · 3.19 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#############################
# LATEST-VERSION-HELPER
#############################
FROM ubuntu:20.04 as latest-version-helper
RUN apt update && apt install -y jq curl
COPY ./src/main/bin/getLatestDockerTag.sh /tmp/run.sh
RUN chmod +x /tmp/run.sh
CMD ["/tmp/run.sh"]
#################################################
# Genomic Transfer Helper
# A helper that contains the song and score clients
#################################################
FROM adoptopenjdk/openjdk11:jre-11.0.6_10-alpine as genomic-transfer-helper
ARG SONG_VERSION=4.4.0
ARG SCORE_VERSION=5.1.0
ENV APP_HOME /srv
ENV EXAMPLE_DATA_DIR=$APP_HOME/example-data
# Song config
ENV CLIENT_ACCESS_TOKEN=some-jwt
ENV CLIENT_STUDY_ID=ABC123
ENV CLIENT_DEBUG=false
ENV CLIENT_SERVER_URL=http://song-api:8080
ENV SONG_CLIENT_DOWNLOAD_URL=https://artifacts.oicr.on.ca/artifactory/dcc-release/bio/overture/song-client/${SONG_VERSION}/song-client-${SONG_VERSION}-dist.tar.gz
# Score config
ENV ACCESSTOKEN=some-jwt
ENV METADATA_URL=http://song-api:8080
ENV STORAGE_URL=http://score-api:8080
ENV SCORE_CLIENT_DOWNLOAD_URL=https://artifacts.oicr.on.ca/artifactory/dcc-release/bio/overture/score-client/${SCORE_VERSION}/score-client-${SCORE_VERSION}-dist.tar.gz
RUN apk add bash curl vim bash-completion \
&& mkdir -p /tmp/scratch $APP_HOME /var/scratch \
&& curl -sL $SONG_CLIENT_DOWNLOAD_URL --output /tmp/song-client.tar.gz \
&& tar zxvf /tmp/song-client.tar.gz -C /tmp/scratch \
&& rm -rf /tmp/song-client.tar.gz \
&& mv /tmp/scratch/* /tmp/scratch/song-client \
&& mv /tmp/scratch/song-client $APP_HOME \
&& chmod 777 -R /var/scratch \
&& mkdir $EXAMPLE_DATA_DIR
COPY ./example-data/ $EXAMPLE_DATA_DIR/
RUN curl -sL $SCORE_CLIENT_DOWNLOAD_URL --output /tmp/score-client.tar.gz \
&& tar zxvf /tmp/score-client.tar.gz -C /tmp/scratch \
&& rm -rf /tmp/score-client.tar.gz \
&& mv /tmp/scratch/* /tmp/scratch/score-client \
&& mv /tmp/scratch/score-client $APP_HOME
RUN echo "alias ls='ls --color'" >> /root/.bashrc \
&& echo "alias ll='ls -l'" >> /root/.bashrc \
&& echo "alias lr='ll -rt'" >> /root/.bashrc \
&& echo "alias l='ll'" >> /root/.bashrc
WORKDIR $APP_HOME
#############################
# Builder
#############################
FROM adoptopenjdk/openjdk11:jdk-11.0.6_10-alpine-slim as builder
WORKDIR /usr/src/app
COPY ./pom.xml .
COPY ./mvnw .
COPY ./.mvn ./.mvn
RUN ./mvnw dependency:go-offline -B
COPY ./src ./src
RUN ./mvnw package -DskipTests
#############################
# CLI
#############################
FROM adoptopenjdk/openjdk11:jre-11.0.6_10-alpine as client
ENV APP_HOME /srv
ENV APP_USER dmsadmin
ENV APP_UID 9999
ENV APP_GID 9999
COPY --from=builder /usr/src/app/target/dms-*.tar.gz $APP_HOME/dms-cli.tar.gz
RUN apk add bash bash-completion \
&& mkdir /tmp/scratch \
&& tar zxvf $APP_HOME/dms-cli.tar.gz -C /tmp/scratch \
&& rm -rf $APP_HOME/dms-cli.tar.gz \
&& mv /tmp/scratch/* /tmp/scratch/dms-cli \
&& mv /tmp/scratch/dms-cli/* $APP_HOME \
&& addgroup -S -g $APP_GID $APP_USER \
&& adduser -S -u $APP_UID -G $APP_USER $APP_USER \
&& chmod 777 -R $APP_HOME \
&& mkdir -p $APP_HOME /var/scratch/ \
&& chown -R $APP_UID:$APP_GID $APP_HOME \
&& chmod 777 -R /var/scratch
ENV PATH $PATH:$APP_HOME/bin
WORKDIR $APP_HOME/bin