forked from plus3it/tardigrade-ci
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (58 loc) · 1.73 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
FROM golang:1.20.5-buster as golang
FROM python:3.11.4-buster
ARG PROJECT_NAME=tardigrade-ci
ARG GITHUB_ACCESS_TOKEN
ENV USER=${PROJECT_NAME}
ENV USER_UID=1000
ENV USER_GID=${USER_UID}
# Things to do as root
USER root
RUN apt-get update -y && apt-get install -y \
xz-utils \
curl \
jq \
unzip \
make \
vim \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libreadline-dev \
libsqlite3-dev \
llvm \
libncursesw5-dev \
tk-dev \
libxml2-dev \
libxmlsec1-dev \
libffi-dev \
liblzma-dev \
&& touch /.dockerenv \
&& rm -rf /var/lib/apt/lists/*
RUN addgroup --gid ${USER_GID} ${USER} \
&& adduser --disabled-password --gecos '' --uid ${USER_UID} --gid ${USER_GID} ${USER}
COPY --from=golang /usr/local/go/ /usr/local/go/
COPY --chown=${USER}:${USER} --from=golang /go/ /go/
COPY --chown=${USER}:${USER} . /${PROJECT_NAME}
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN make -C /${PROJECT_NAME} fixuid/install \
&& cp /root/bin/fixuid /usr/local/bin/fixuid \
&& chown root:root /usr/local/bin/fixuid \
&& chmod 4755 /usr/local/bin/fixuid\
&& mkdir -p /etc/fixuid \
&& printf "user: $USER\ngroup: $USER\n" > /etc/fixuid/config.yml
# Things to do as $USER
USER ${USER}
ENV HOME="/home/${USER}"
ENV PYENV_ROOT=${HOME}/.pyenv
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:${HOME}/.local/bin:${HOME}/bin:/go/bin:/usr/local/go/bin:${PATH}"
ENV GOPATH=/go
RUN make -C /${PROJECT_NAME} install
# Install python versions
RUN make -C /${PROJECT_NAME} python38/install \
&& pyenv global system $(pyenv versions | grep 3.8)
RUN python --version \
&& python3 --version \
&& python3.8 --version
WORKDIR /${PROJECT_NAME}
ENTRYPOINT ["entrypoint.sh"]