This repository was archived by the owner on Mar 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
122 lines (97 loc) · 3.39 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
FROM ruby:3.1.2-alpine3.16
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
RUN apk add --update --no-cache \
bash \
binutils \
build-base \
curl \
curl-dev \
git \
gnupg \
make \
openssh-client \
py3-pip \
python3-dev \
shadow \
sudo \
tree \
wget
RUN ln -sf python3 /usr/bin/python
# dojo helper script
ENV DOJO_VERSION=0.11.0
RUN git clone --depth 1 -b ${DOJO_VERSION} \
https://github.com/kudulab/dojo.git /tmp/dojo_git && \
/tmp/dojo_git/image_scripts/src/install.sh && \
rm -r /tmp/dojo_git
# dojo user
COPY image/bashrc /home/dojo/.bashrc
COPY image/profile /home/dojo/.profile
RUN chown dojo:dojo /home/dojo/.bashrc /home/dojo/.profile
# install assume-role which is a handy tool
RUN wget --tries=3 --retry-connrefused --wait=3 --random-wait \
--quiet \
https://github.com/remind101/assume-role/releases/download/0.3.2/assume-role-Linux && \
chmod +x ./assume-role-Linux && \
mv ./assume-role-Linux /usr/bin/assume-role
COPY image/etc_dojo.d/scripts/* /etc/dojo.d/scripts/
COPY image/inputrc /etc/inputrc
# jekyll
ENV GEM_HOME=/home/dojo/.bundle
ENV BUNDLE_PATH=/home/dojo/.bundle
ENV BUNDLE_BIN=/home/dojo/bin
ENV PATH=/home/dojo/bin:$PATH
RUN mkdir -p /home/dojo/.bundle /home/dojo/bin
RUN chown -R dojo:dojo /home/dojo/.bundle /home/dojo/bin
COPY image/Gemfile /home/dojo/Gemfile
COPY image/Gemfile.lock /home/dojo/Gemfile.lock
RUN gem install bundler
RUN cd /home/dojo && bundle install
# awscli
RUN apk add gcompat
ENV AWS_CLI_VERSION=2.1.39
ENV CPU_ARCH=x86_64
COPY image/aws.gpg /opt/aws.gpg
# TODO: Figure out how to support x86_64 and aarch64 with multi-cpu architecture support
RUN cd /tmp && \
curl -sL \
https://awscli.amazonaws.com/awscli-exe-linux-${CPU_ARCH}-${AWS_CLI_VERSION}.zip.sig \
-o awscliv2.sig && \
curl -sL "https://awscli.amazonaws.com/awscli-exe-linux-${CPU_ARCH}-${AWS_CLI_VERSION}.zip" \
-o "awscliv2.zip" && \
gpg --import /opt/aws.gpg && \
gpg --verify awscliv2.sig awscliv2.zip && \
unzip -q awscliv2.zip
RUN cd /tmp && pwd && ls -alF ./aws ./aws/dist
RUN cd /tmp && ./aws/install
RUN uname -a
# RUN aws --version
# RUN rm -rf /tmp/awscliv2.zip /tmp/aws
# Install spin tool binaries and scripts
RUN mkdir -p /opt/spin-tools/bin
COPY image/bin/ /opt/spin-tools/bin/
RUN for binary in /opt/spin-tools/bin/* ; do ln -s $binary /usr/local/bin/ ; done
ENV SPIN_BIN_DIR=/usr/local/bin
# BATS testing tool
ENV BATS_CORE_VERSION=1.7.0
ENV BATS_HELPER_DIR=/opt
RUN cd /tmp && \
git clone --depth 1 -b v${BATS_CORE_VERSION} https://github.com/bats-core/bats-core.git && \
cd bats-core && \
./install.sh ${BATS_HELPER_DIR} && \
rm -r /tmp/bats-core && \
ln -s /opt/bin/bats /usr/bin/bats
ENV BATS_SUPPORT_VERSION=0.3.0
RUN git clone -b v${BATS_SUPPORT_VERSION} https://github.com/bats-core/bats-support.git ${BATS_HELPER_DIR}/bats-support
ENV BATS_ASSERT_VERSION=2.0.0
RUN git clone -b v${BATS_ASSERT_VERSION} https://github.com/bats-core/bats-assert.git ${BATS_HELPER_DIR}/bats-assert
# Copy self-tests into the image
COPY test/self/ /opt/site-spin/test/
RUN chown -R dojo:dojo /opt/site-spin/test
# Set version environment variables
ARG EXTERNAL_VERSION_NUMBER not_set
ENV SITE_SPIN_VERSION=$EXTERNAL_VERSION_NUMBER
RUN echo "EXTERNAL_VERSION_NUMBER = $EXTERNAL_VERSION_NUMBER"
RUN echo "SITE_SPIN_VERSION = $SITE_SPIN_VERSION"
EXPOSE 4000
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
CMD ["/bin/bash"]