Use custom install Script as Terraform Resource

Hi, I want to create my own template containing some custom installs. The base template is Docker Container and I want to extend it. Now I am unsure if I should use the Dockerfile to do the installations or if I should use a Terraform Resource. I want to place the instructions in a .sh file executed as the current workspace user with the home dir as the workdir.
2 Replies
Codercord
Codercord3mo ago
<#1286659026519724094>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
outroddet_
outroddet_OP3mo ago
#!/bin/sh

pip3 install findspark pyspark --break-system-packages
#!/bin/sh

pip3 install findspark pyspark --break-system-packages
Test install.sh file
FROM ubuntu

RUN apt-get update \
&& apt-get install -y \
curl \
git \
python3 \
python3-pip \
sudo \
vim \
nano \
openjdk-8-jdk \
wget \
&& rm -rf /var/lib/apt/lists/*

ARG USER=coder
RUN useradd --groups sudo --no-create-home --shell /bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
USER ${USER}
WORKDIR /home/${USER}
FROM ubuntu

RUN apt-get update \
&& apt-get install -y \
curl \
git \
python3 \
python3-pip \
sudo \
vim \
nano \
openjdk-8-jdk \
wget \
&& rm -rf /var/lib/apt/lists/*

ARG USER=coder
RUN useradd --groups sudo --no-create-home --shell /bin/bash ${USER} \
&& echo "${USER} ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/${USER} \
&& chmod 0440 /etc/sudoers.d/${USER}
USER ${USER}
WORKDIR /home/${USER}
Dockerfile I want that everything will be executed with the workspace user for full permissions.
Want results from more Discord servers?
Add your server