-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
84 lines (75 loc) · 3.12 KB
/
Dockerfile
File metadata and controls
84 lines (75 loc) · 3.12 KB
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
# Use Ubuntu 26.04 as the base image
FROM ubuntu:26.04
# Labels
LABEL org.opencontainers.image.source=https://github.com/Cloud-Officer/ci-tools
LABEL org.opencontainers.image.description="This is a collection of tools to run locally or on a CI pipeline."
LABEL org.opencontainers.image.licenses=MIT
# Set the environment variable to noninteractive to avoid prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
# Update and install dependencies
RUN \
apt-get update && \
apt-get install --no-install-recommends --yes \
autoconf \
autogen \
automake \
build-essential \
ca-certificates \
clang \
curl \
file \
gcc \
git \
git-lfs \
intltool \
libtool \
libtool-bin \
make \
pkg-config \
ruby \
ruby-all-dev \
ruby-build \
ruby-bundler \
ruby-dev \
ssh \
sudo \
unzip \
wget \
zip \
&& \
rm -rf /var/lib/apt/lists/*
# Install AWS dependencies
WORKDIR /tmp
RUN \
ssm_arch="$(test "$(uname -m)" = "x86_64" && echo "64bit" || echo "arm64")" && \
# install AWS CLI \
curl -fsSL "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
./aws/install && \
# download AWS CLI SSM plugin \
curl -fsSL "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_${ssm_arch}/session-manager-plugin.deb" -o "session-manager-plugin.deb" && \
# patch buggy AWS package (inject shebangs in shell scripts, fix permissions, fix missing file) \
dpkg-deb --raw-extract session-manager-plugin.deb tmp-deb && \
sed -i '1i #!/bin/sh' tmp-deb/DEBIAN/preinst && \
sed -i '1i #!/bin/sh' tmp-deb/DEBIAN/postinst && \
sed -i '1i #!/bin/sh' tmp-deb/DEBIAN/prerm && \
sed -i '1i #!/bin/sh' tmp-deb/DEBIAN/postrm && \
chmod 0755 tmp-deb/DEBIAN/pre* tmp-deb/DEBIAN/post* && \
touch tmp-deb/usr/local/sessionmanagerplugin/seelog.xml && \
# install patched package \
dpkg-deb --build tmp-deb session-manager-plugin.patched.deb && \
dpkg -i session-manager-plugin.patched.deb && \
rm -rf ./aws/ awscliv2.zip session-manager-plugin*deb
# Add user/group citools and add ubuntu user to that group
RUN useradd -m -s /bin/bash citools && echo 'citools ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers && adduser ubuntu citools
# Clone the soup repository
ADD https://github.com/Cloud-Officer/ci-tools.git /home/citools/ci-tools
# Install ci-tools dependencies and create a symlink
USER root
WORKDIR /home/citools/ci-tools
RUN chown -R citools:citools . && bundle install && ln -s "/home/citools/ci-tools/brew-resources.rb" "/usr/local/bin/brew-resources" && ln -s "/home/citools/ci-tools/cycle-keys.rb" "/usr/local/bin/cycle-keys" && ln -s "/home/citools/ci-tools/deploy.rb" "/usr/local/bin/deploy" && ln -s "/home/citools/ci-tools/encrypt-logs.rb" "/usr/local/bin/encrypt-logs" && ln -s "/home/citools/ci-tools/generate-codeowners" "/usr/local/bin/generate-codeowners" && ln -s "/home/citools/ci-tools/linters" "/usr/local/bin/linters" && ln -s "/home/citools/ci-tools/ssm-jump" "/usr/local/bin/ssm-jump"
# Healthcheck
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 CMD pgrep -x sleep || exit 1
# Entrypoint
USER citools
CMD ["bash", "-c", "sleep 86400"]