Adds basic container setup with pipeline (#1)
ci/woodpecker/push/test Pipeline was successful Details
ci/woodpecker/push/next Pipeline was successful Details
ci/woodpecker/push/master Pipeline was successful Details

#### 📖 Summary

- adds dockerfile
- adds woodpecker pipelines

#### 📑 Test Plan

> 💡 Select your test plan for the code changes.

- [x] Tested with CI pipeline
- [ ] Custom test
- [ ] No test plan

##### Details / Justification

<!-- Add your test details or justification for missing tests here. -->

#### 📚 Additional Notes

<!-- A place for additional detail notes. -->

Co-authored-by: OCram85 <marco.blessing@googlemail.com>
Reviewed-on: CodeServer/Container#1
This commit is contained in:
OCram85 2022-11-07 16:01:31 +01:00
parent 46272cf0e2
commit 1d79a803f7
5 changed files with 191 additions and 18 deletions

21
.woodpecker/.master.yml Normal file
View File

@ -0,0 +1,21 @@
depends_on:
- test
pipeline:
buildMasterGitea:
image: plugins/docker
settings:
registry: gitea.ocram85.com
repo: gitea.ocram85.com/codeserver/container
dockerfile: Dockerfile
auto_tag: true
#build_args:
# - NODE_BASE=lts-buster-slim
# - NGINX_BASE=1.23.1-alpine
username:
from_secret: gitea_user
password:
from_secret: gitea_passwd
when:
event: push
branch: master

19
.woodpecker/.next.yml Normal file
View File

@ -0,0 +1,19 @@
depends_on:
- test
pipeline:
buildNextGitea:
image: woodpeckerci/plugin-docker-buildx
settings:
#dry_run: true
registry: gitea.ocram85.com
repo: gitea.ocram85.com/codeserver/container
platforms: linux/amd64
dockerfile: Dockerfile
tags: next
username:
from_secret: gitea_user
password:
from_secret: gitea_passwd
when:
event: pull_request

9
.woodpecker/.test.yml Normal file
View File

@ -0,0 +1,9 @@
pipeline:
testDockerfile:
image: plugins/docker
settings:
dry_run: true
registry: gitea.ocram85.com
repo: gitea.ocram85.com/codeserver/container
dockerfile: Dockerfile
tags: next

View File

@ -2,28 +2,19 @@ FROM linuxserver/code-server:4.7.1
RUN \
echo "**** install starshipt prompt ****" && \
curl -sS https://starship.rs/install.sh | sh && \
curl -sS https://starship.rs/install.sh | sh -s -- -f && \
echo "eval \"\$(starship init bash)\"" >> /etc/bash.bashrc
ENV STARSHIP_CONFIG=/etc/starship.tom
ENV STARSHIP_CONFIG=/etc/starship.toml
COPY staship.toml /etc/starship.toml
COPY starship.toml /etc/starship.toml
RUN \
"**** setup git ****" && \
git config --system credential.helper store
echo "**** setup git ****" && \
git config --system credential.helper store && \
echo 'source /usr/share/bash-completion/completions/git' >> /etc/bash.bashrc
ADD install-devruntime /usr/bin/
RUN \
echo "**** install dev runtimes ****" && \
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - && \
apt-get update && \
apt-get install -y \
nodejs \
golang-go &&\
echo "**** clean up ****" && \
apt-get clean && \
rm -rf \
/config/* \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
chmod +x /usr/bin/install-devruntime && \
echo "echo \"Use 'install-devruntime' to install missing runtimes like dotnet or NodeJs.\"" >> /etc/bash.bashrc

133
install-devruntime Executable file
View File

@ -0,0 +1,133 @@
#!/bin/bash
set -e
function showHelp() {
cat <<HELP
install-devruntime is used to install optional runtimes for developing in a
code-server container environment.
Syntax: install-devruntime RUNTIME ...
RUNTIME [dotnet|golang|nodejs|powershell]
dotnet Installs latest LTS dotnet core sdk + runtime.
golang Installs golang 1.19.3.
nodejs Installs latest NodeJs LTS version.
powershell Installs latest PowerShell LTS version.
-h Prints this help messagee.
Example 1: install-devruntime dotnet
Example 2: install devruntime golang nodejs
HELP
}
function say() {
if [[ -n "$2" ]]; then
echo -e "\e[32mInstall-DevRuntime\e[0m \e[34m[$2]\e[0m: $1"
else
echo -e "\e[32mInstall-DevRuntime\e[0m: $1"
fi
}
function sayE() {
if [[ -n "$2" ]]; then
echo -e "\e[31mInstall-DevRuntime\e[0m \e[34m[$2]\e[0m: $1" 1>&2
else
echo -e "\e[31mInstall-DevRuntime\e[0m: $1" 1>&2
fi
}
function instDotNet() {
say "Downloading latest install script..." "dotnet"
curl -fsSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh
chmod +x /tmp/dotnet-install.sh
say "Installing latest .NET Core LTS release..." "dotnet"
/tmp/dotnet-install.sh --channel LTS
echo 'export PATH=$PATH:/config/.dotnet' | sudo tee -a /etc/bash.bashrc > /dev/null
say "dotnet done. " "dotnet"
}
function instGoLang() {
if [[ -z "$1" ]]; then
GOVERSION="1.19.3"
else
GOVERSION="$1"
fi
say "Downloading golang ($GOVERSION)..." "GoLang"
curl -fsSL "https://go.dev/dl/go$GOVERSION.linux-amd64.tar.gz" -o /tmp/golang.tar.gz
say "Installing golang ($GOVERSION)...." "GoLang"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf /tmp/golang.tar.gz
echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee -a /etc/bash.bashrc > /dev/null
say "Cleaning up..." "GoLang"
rm -f /tmp/golang.tar.gz
say "done." "GoLang"
say "Please reload bash profile to finalize." "GoLang"
}
function instNodeJs() {
say "Adding nodesource package source (NodeJS LTS)..." "NodeJs"
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
say "Updating package lists and installing NodeJS LTS..." "NodeJs"
sudo apt-get install --no-install-recommends -y \
nodejs
say "Cleaning up..." "NodeJs"
sudo apt-get clean
sudo rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
say "done." "NodeJs"
}
function instPwsh() {
say "Installing PowerShell requirements..." "PowerShell"
sudo apt-get install --no-install-recommends -y \
apt-transport-https \
software-properties-common
say "Adding powershell package sources..." "PowerShell"
# Download the Microsoft repository GPG keys
curl -fsSL "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" -o /tmp/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i /tmp/packages-microsoft-prod.deb
# Update the list of packages after we added packages.microsoft.com
sudo apt-get update
say "Installing PowerShell..." "PowerShell"
# Install PowerShell
sudo apt-get install --no-install-recommends -y powershell
echo "done." "PowerShell"
}
function main() {
if [[ "$#" == "0" ]]; then
showHelp
exit 0
fi
for i in $@; do
if [[ "$1" == "-h" ]]; then
showHelp
exit 0
elif [[ "$i" == "dotnet" ]]; then
instDotNet
elif [[ "$i" == "golang" ]]; then
instGoLang
elif [[ "$i" == "nodejs" ]]; then
instNodeJs
elif [[ "$i" == "powershell" ]]; then
instPwsh
else
sayE "Unknown parameter value given!($i)."
showHelp
exit 1
fi
done
}
main $@