This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
73 lines (54 loc) · 2.43 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
FROM quay.io/centos/centos:stream8
RUN dnf -y update
ARG RUNNER_VERSION=latest
ARG PYENV_VERSION_BRANCH=v1.2.26
ARG PYTHON_VERSION=3.9.4
WORKDIR /var/lib/refactr/agent
# Install dnf packages
RUN dnf upgrade -y
RUN dnf install -y sudo gcc openssh openssh-clients git ca-certificates wget \
unzip which jq python3-pip python3-devel @development zlib-devel \
bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz \
xz-devel libffi-devel findutils glibc-locale-source glibc-langpack-en
# Add wheel group to passwordless sudoers
RUN echo '%wheel ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Update locales
RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8
# https://github.com/pypa/pip/issues/8658#issuecomment-666357669
ENV LANG en_US.utf8
ENV LC_ALL en_US.utf8
# Alias python and pip
RUN alternatives --set python /usr/bin/python3 && \
ln -sf /usr/bin/pip3 /usr/bin/pip
# Install python-build
RUN git clone --depth 1 --branch $PYENV_VERSION_BRANCH https://github.com/pyenv/pyenv.git --single-branch
RUN bash -c pyenv/plugins/python-build/install.sh
# Install pip packages
#RUN pip install --upgrade pip
RUN pip install setuptools==44.1.1 wheel==0.34.2
RUN pip install packaging virtualenv python-daemon
# Install utilities for tool installers
# https://github.com/pyenv/pyenv/wiki
RUN dnf install -y @development zlib-devel bzip2-devel readline-devel sqlite \
sqlite-devel openssl-devel xz xz-devel libffi-devel findutils
# Create runtime user
RUN useradd -U -m refactr-runner -G wheel
# Set up directories
RUN mkdir -p /workspace
RUN mkdir -p /cache
RUN touch /etc/profile.d/001-refactr-path.sh
# Pre-install Python 3.x
ARG PYTHON_CACHE_PATH=/cache/python/$PYTHON_VERSION/x64
RUN python-build $PYTHON_VERSION $PYTHON_CACHE_PATH
ENV PATH=$PYTHON_CACHE_PATH/bin:$PATH
# Set up permissions.
RUN chown -R refactr-runner:refactr-runner /etc/profile.d/001-refactr-path.sh /workspace /cache
# Install runner agent
RUN curl -o /tmp/runner-agent_linux-x64.tgz https://sfact-releases.s3.us-west-2.amazonaws.com/runner/runner-agent_linux-x64_$RUNNER_VERSION.tgz
RUN tar -xzf /tmp/runner-agent_linux-x64.tgz -C /var/lib/refactr/agent
RUN chown -R refactr-runner:refactr-runner /var/lib/refactr/agent
# Runtime user
USER refactr-runner
RUN mkdir -p /home/refactr-runner/.ssh
RUN echo -e "Host *\n StrictHostKeyChecking no\n UserKnownHostsFile /dev/null" > /home/refactr-runner/.ssh/config
CMD ["/var/lib/refactr/agent/runner-agent_linux-x64.exe"]