-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContainerfile-alpine
More file actions
53 lines (42 loc) · 1.66 KB
/
Copy pathContainerfile-alpine
File metadata and controls
53 lines (42 loc) · 1.66 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
FROM docker.io/alpine:3.21.3
ARG TARGETPLATFORM
ARG OPENTOFU_VERSION=1.9.0
ARG TERRAGRUNT_VERSION=0.75.3
ARG YQ_VERSION=4.45.1
RUN apk add --no-cache \
git \
curl \
bash \
gcompat \
jq \
openssh-keygen \
sudo \
shadow \
openssl \
openssh \
&& rm -rf /var/cache/apk/*
RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \
chmod +x install-opentofu.sh && \
./install-opentofu.sh --install-method apk --opentofu-version ${OPENTOFU_VERSION} && \
rm -f install-opentofu.sh
RUN curl -Lso /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/v${YQ_VERSION}/yq_linux_$(if [[ "$TARGETPLATFORM" =~ "linux/arm64" ]]; then echo "arm64"; else echo "amd64"; fi)" && chmod +x /usr/local/bin/yq
RUN curl -sLo ./terragrunt https://github.com/gruntwork-io/terragrunt/releases/download/v${TERRAGRUNT_VERSION}/terragrunt_linux_$(if [[ "$TARGETPLATFORM" =~ "linux/arm64" ]]; then echo "arm64"; else echo "amd64"; fi) && \
chmod +x ./terragrunt && \
mv ./terragrunt /usr/bin/terragrunt
##################################
# User setup
##################################
# Configure sudoers so that sudo can be used without a password
RUN groupadd --force sudo && \
chmod u+w /etc/sudoers && \
echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
ENV HOME=/home/devops
# Create devops user
RUN useradd -u 10000 -g root -G sudo -d ${HOME} -m devops && \
usermod --password $(echo password | openssl passwd -1 -stdin) devops && \
mkdir -p /workspaces && \
chown -R 10000:0 /workspaces && \
chmod -R g=u /workspaces ${HOME}
USER devops
WORKDIR ${HOME}
ENTRYPOINT ["/bin/bash"]