-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
91 lines (72 loc) · 2.42 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
# SERVICE BUILDER IMAGE
FROM golang:alpine AS binbuilder
# Build package deps
RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories \
&& apk --no-cache --no-progress add \
bash \
curl \
git \
openssh
# Download git-annex to builder and extract
RUN mkdir /git-annex
RUN curl -Lo /git-annex/git-annex-standalone-amd64.tar.gz https://downloads.kitenet.net/git-annex/linux/current/git-annex-standalone-amd64.tar.gz
RUN cd /git-annex && tar -xzf git-annex-standalone-amd64.tar.gz && rm git-annex-standalone-amd64.tar.gz
ENV GOPROXY https://proxy.golang.org
RUN go version
COPY ./go.mod ./go.sum /gin-valid/
WORKDIR /gin-valid
# download deps before bringing in the sources
RUN go mod download
COPY ./cmd /gin-valid/cmd/
COPY ./internal /gin-valid/internal/
RUN go build ./cmd/ginvalid
### ============================ ###
# RUNNER IMAGE
FROM alpine:3.16
# Runtime deps
RUN echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories
RUN echo http://dl-2.alpinelinux.org/alpine/edge/testing/ >> /etc/apk/repositories
RUN echo http://dl-2.alpinelinux.org/alpine/edge/main/ >> /etc/apk/repositories
RUN apk --no-cache --no-progress add \
bash \
git \
nodejs \
npm \
openssh \
py3-tomli \
py3-pip \
python3-dev \
py3-numpy \
py3-h5py
# Install the BIDS validator
RUN npm install -g bids-validator
# Upgrade pip before install python packages
RUN pip3 install -U pip
# Install odml for odML validation
RUN pip3 install odml
# Copy odML validation script
COPY ./scripts/odml-validate /bin
# Copy test data
COPY ./resources /resources
# Install NIXPy for NIX validation
RUN pip3 install --no-cache-dir nixio
# Copy git-annex from builder image
COPY --from=binbuilder /git-annex /git-annex
ENV PATH="${PATH}:/git-annex/git-annex.linux"
RUN mkdir -p /gin-valid/results/
RUN mkdir -p /gin-valid/tmp/
RUN mkdir -p /gin-valid/config
RUN mkdir -p /gin-valid/tokens/by-sessionid
RUN mkdir -p /gin-valid/tokens/by-repo
ENV GINVALIDHOME /gin-valid/
WORKDIR /gin-valid
ENV GIN_CONFIG_DIR /gin-valid/config/client
# Copy binary and resources into runner image
COPY --from=binbuilder /gin-valid/ginvalid /
COPY ./assets /assets
# Test validation
RUN odml-validate /resources/odmldata.odml
RUN nixio validate /resources/nixdata.nix
RUN bids-validator --version
ENTRYPOINT /ginvalid --config=/gin-valid/config/cfg.json
EXPOSE 3033