forked from cossacklabs/acra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci-py-go-themis.dockerfile
106 lines (85 loc) · 3.48 KB
/
ci-py-go-themis.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
100
101
102
103
104
105
106
FROM debian:bookworm
SHELL ["/bin/bash", "-c"]
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
apt-transport-https \
build-essential \
ca-certificates \
curl \
default-mysql-client \
git \
gnupg \
libpq-dev \
libssl-dev \
openssl \
postgresql-client \
psmisc \
python3 python3-setuptools python3-pip python3.11-venv \
rsync \
sudo \
rustc \
wget
WORKDIR /root
# Install MariaDB Connector/C for mariadb python driver
RUN wget https://r.mariadb.com/downloads/mariadb_repo_setup && \
echo "935944a2ab2b2a48a47f68711b43ad2d698c97f1c3a7d074b34058060c2ad21b mariadb_repo_setup" \
| sha256sum -c - && chmod +x mariadb_repo_setup
# Configure the CS package repository using the mariadb_repo_setup utility:
RUN sudo /root/mariadb_repo_setup --mariadb-server-version="mariadb-11.2"
RUN apt -y install libmariadb3 libmariadb-dev
# Install libthemis:
# RUN set -o pipefail && \
# curl -sSL https://pkgs.cossacklabs.com/scripts/libthemis_install.sh | \
# bash -s -- --yes
RUN cd /root \
&& git clone --depth 1 -b stable https://github.com/cossacklabs/themis
RUN cd /root/themis \
&& make \
&& make install
# Include helpful scripts
RUN mkdir /image.scripts
COPY docker/_scripts/acra-build/install_go.sh /image.scripts/
COPY docker/_scripts/acra-build/install_go.csums /image.scripts/
COPY go.mod /image.scripts/
RUN chmod +x /image.scripts/*.sh
# Install Go
RUN GO_VERSIONS='1.21.0' \
GO_TARBALL_CLEAN=1 \
/image.scripts/install_go.sh
ENV GOROOT="/usr/local/lib/go/latest" GOPATH="/home/user/gopath" GO111MODULE="auto"
# Create the user and allow using `sudo` without password
RUN useradd -m user && \
echo 'user ALL=(ALL) NOPASSWD:ALL' >/etc/sudoers.d/90-user
USER user
WORKDIR /home/user
#
# from now we'll run stuff as `user`, not as `root`
#
# `go get` installs binaries into $GOPATH/bin, thus into ~/gopath/bin
# `pip` installs binaries into ~/.local/bin
ENV PATH="$GOROOT/bin:/home/user/gopath/bin:/home/user/.local/bin:$PATH"
# Install some Go linters
RUN go install golang.org/x/lint/[email protected] && \
go install github.com/client9/misspell/cmd/[email protected] && \
go install golang.org/x/tools/cmd/[email protected] && \
go install github.com/swaggo/swag/cmd/[email protected] && \
go install github.com/gordonklaus/[email protected]
# download dependencies to avoid next downloads in tests
RUN cp /image.scripts/go.mod . && go mod download && rm go.mod go.sum
# Install Python tests dependencies
COPY tests/requirements.txt /home/user/python_tests_requirements.txt
COPY wrappers/python/acrawriter/test-requirements.txt /home/user/python_acrawriter_tests_requirements.txt
# setup virtualenv
RUN python3 -m venv ./venv
ENV VIRTUAL_ENV /home/user/venv
ENV PATH /home/user/venv/bin:$PATH
RUN pip3 install -r /home/user/python_tests_requirements.txt && \
# run as separate command due to same dependency 'sqlalchemy' to avoid duplicated requirement and error \
pip3 install -r $HOME/python_acrawriter_tests_requirements.txt && \
# install from sources because pip install git+https://... not support recursive submodules \
git clone https://github.com/Lagovas/mysql-connector-python && \
cd mysql-connector-python && \
/home/user/venv/bin/python3 setup.py clean build_py && \
sudo /home/user/venv/bin/python3 setup.py install_lib && \
cd - && \
sudo rm -rf mysql-connector-python