forked from decred/dcrdocker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-dcrdata-builder
61 lines (46 loc) · 1.87 KB
/
Dockerfile-dcrdata-builder
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
#DOCKER_IMAGE_TAG=dcrdata-golang-builder-1.11
# This image may be used to build and test dcrdata with run_tests.sh:
# ./run_tests.sh 1.11
FROM golang:1.11.5
LABEL description="Decred dcrdata builder image"
LABEL version="1.0"
LABEL maintainer "[email protected]"
ENV TERM linux
ENV USER build
# create user
RUN adduser --disabled-password --gecos '' $USER
# update base distro & install build tooling
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -qy apt-transport-https ca-certificates
ENV NODE_VERSION node_11.x
RUN curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
DISTRO=`grep VERSION= /etc/os-release | awk -F"[()]" '{print $2}'` && \
echo "deb https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
echo "deb-src https://deb.nodesource.com/$NODE_VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list
RUN apt-get update && \
apt-get install -qy rsync git xz-utils apt-utils nodejs && \
echo Node.js: `node --version`
RUN npm install stylelint stylelint-config-standard eslint -g
# create directory for build artifacts, adjust user permissions
RUN mkdir /release && \
chown $USER /release
# create directory to get source from
RUN mkdir /src && \
chown $USER /src && \
mkdir -p /go/src/github.com/decred && \
chown -R $USER /go/src
# switch user
USER $USER
ENV HOME /home/$USER
# Install linters
ENV GOMETALINTER_TAG v2.0.5
ENV GOLANGCI_TAG v1.13.1
WORKDIR /go/src
RUN git clone --branch $GOLANGCI_TAG https://github.com/golangci/golangci-lint && \
cd golangci-lint/cmd/golangci-lint && \
GO111MODULE=on go install && \
go get -v github.com/alecthomas/gometalinter && \
cd /go/src/github.com/alecthomas/gometalinter && \
git checkout $GOMETALINTER_TAG && \
go install -i && \
gometalinter --install