-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker file to build the image to execute CI
- Loading branch information
1 parent
f9eefdd
commit 9620a9c
Showing
4 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM python:3.6.15 | ||
ARG EXTRA_PYPI_INDEX=https://pypi.org/simple | ||
|
||
# Allows for log messages by `print` in Python to be immediately dumped | ||
# to the stream instead of being buffered. | ||
ENV PYTHONUNBUFFERED 0 | ||
|
||
COPY docker/scripts/bashrc /etc/bash.bashrc | ||
RUN chmod a+rx /etc/bash.bashrc | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
unzip \ | ||
curl \ | ||
git \ | ||
software-properties-common \ | ||
g++ \ | ||
wget \ | ||
cmake \ | ||
ca-certificates \ | ||
shellcheck \ | ||
clang-format > /dev/null && \ | ||
python -m pip install --quiet --upgrade pip | ||
|
||
# Install Go and related tools | ||
ARG GO_MIRROR_URL=https://dl.google.com/go | ||
ENV GOPATH /root/go | ||
ENV PATH /usr/local/go/bin:$GOPATH/bin:$PATH | ||
COPY docker/scripts/install-go.bash / | ||
RUN /install-go.bash ${GO_MIRROR_URL} && rm /install-go.bash | ||
|
||
# Install protobuf and protoc | ||
COPY docker/scripts/install-protobuf.bash / | ||
RUN /install-protobuf.bash && rm /install-protobuf.bash | ||
|
||
# Install Pre-commit | ||
RUN pip install pre-commit pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
export PS1="\[\e[31m\]easydl-docker\[\e[m\] \[\e[33m\]\w\[\e[m\] > " | ||
export TERM=xterm-256color | ||
alias grep="grep --color=auto" | ||
alias ls="ls --color=auto" | ||
|
||
echo -e "\e[1;31m" | ||
cat<<EasyDL | ||
______ ____ __ | ||
/ ____/____ _ _____ __ __ / __ \ / / | ||
/ __/ / __ // ___// / / // / / // / | ||
/ /___ / /_/ /(__ )/ /_/ // /_/ // /___ | ||
/_____/ \__,_//____/ \__, //_____//_____/ | ||
/____/ | ||
EasyDL | ||
echo -e "\e[0;33m" | ||
|
||
if [[ $EUID -eq 0 ]]; then | ||
cat <<WARN | ||
WARNING: You are running this container as root, which can cause new files in | ||
mounted volumes to be created as the root user on your host machine. | ||
To avoid this, run the container by specifying your user's userid: | ||
$ docker run -u \$(id -u):\$(id -g) args... | ||
WARN | ||
else | ||
cat <<EXPL | ||
You are running this container as user with ID $(id -u) and group $(id -g), | ||
which should map to the ID and group for your user on the Docker host. Great! | ||
EXPL | ||
fi | ||
|
||
# Turn off colors | ||
echo -e "\e[m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
GO_MIRROR_URL=$1 | ||
|
||
curl --silent "$GO_MIRROR_URL"/go1.13.4.linux-amd64.tar.gz | \ | ||
tar -C /usr/local -xzf - | ||
|
||
go env -w GO111MODULE=on | ||
go env -w GOPROXY=https://goproxy.io,direct | ||
|
||
go get github.com/golang/protobuf/[email protected] > /dev/null | ||
go get golang.org/x/lint/golint > /dev/null | ||
go get golang.org/x/tools/cmd/goyacc > /dev/null | ||
go get golang.org/x/tools/cmd/cover > /dev/null | ||
go get github.com/mattn/goveralls > /dev/null | ||
go get github.com/rakyll/gotest > /dev/null | ||
|
||
cp "$GOPATH"/bin/* /usr/local/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
wget -q https://github.com/protocolbuffers/protobuf/releases/download/v3.7.1/protoc-3.7.1-linux-x86_64.zip | ||
unzip -qq protoc-3.7.1-linux-x86_64.zip -d /usr/local | ||
rm protoc-3.7.1-linux-x86_64.zip |