-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
93 lines (77 loc) · 2.94 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
FROM python:3.11.7
ARG DEBIAN_FRONTEND="noninteractive"
USER root
WORKDIR /home/xuser
RUN set -e \
&& useradd -r -g users -u 999 -m -d /home/xuser -s /bin/bash xuser \
&& mkdir -p /home/xuser/go \
&& chown 999:100 /home/xuser
ENV GOVERSION=1.21.5
ENV GOARCH=amd64
ENV GOOS=linux
ENV GOPATH=/home/xuser/go
ENV GO_CHECKSUM=e2bc0b3e4b64111ec117295c088bde5f00eeed1567999ff77bc859d7df70078e
RUN set -e \
&& curl -kLO https://dl.google.com/go/go${GOVERSION}.${GOOS}-${GOARCH}.tar.gz \
&& echo "${GO_CHECKSUM} go${GOVERSION}.${GOOS}-${GOARCH}.tar.gz" | sha256sum --check \
&& tar -C /usr/local/ -xvzf go${GOVERSION}.${GOOS}-${GOARCH}.tar.gz \
&& PATH=/usr/local/go/bin:$PATH go version \
&& rm -v go${GOVERSION}.${GOOS}-${GOARCH}.tar.gz
ENV PATH="${PATH}:/usr/local/go/bin"
ENV GOLANGCI_LINT_VERSION="1.55.0"
RUN set -e \
&& curl -sSfL https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz -o golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz \
&& curl -sSfL https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-checksums.txt | grep linux-amd64.tar.gz | sha256sum --check \
&& tar -C /usr/local/bin -xzvf golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64/golangci-lint --strip-components 1 \
&& rm -vf golangci-lint-${GOLANGCI_LINT_VERSION}-linux-amd64.tar.gz
RUN set -e \
&& apt-get update -y \
&& apt-get install -y \
git \
gnupg \
apt-utils \
apt-transport-https \
ca-certificates \
gnupg-agent \
nodejs \
npm \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/usr/share/man/?? \
/usr/share/man/??_*
RUN set -e \
&& npm install -g --save --save-exact remark-cli \
remark-preset-lint-recommended \
markdownlint-cli \
prettier \
@commitlint/cli @commitlint/config-conventional \
&& echo "export PATH=\$PATH:\$HOME/node_modules/.bin" >> /home/xuser/.bashrc \
&& echo "module.exports = {extends: ['@commitlint/config-conventional']}" > /home/xuser/commitlint.config.js \
&& pip3 install --upgrade \
pre-commit \
yamllint \
black \
isort \
flake8 \
tox \
pip \
wheel \
pbr \
coverage \
setuptools \
pytest \
twine
COPY scripts/x-*-hooks.sh /usr/local/bin/
COPY x-hook-*.sh /usr/local/bin/
WORKDIR /pre-commit
ENV XDG_CACHE=/tmp/.cache
ENV PRE_COMMIT_HOME=/pre-commit/.cache/pre-commit
COPY pre-commit-config-all.yaml .pre-commit-config.yaml
RUN set -e \
&& chmod +x /usr/local/bin/x-hook-*.sh /usr/local/bin/x-*-hooks.sh \
&& git init \
&& git add --all :/ \
&& pre-commit install-hooks \
&& pre-commit autoupdate