Last active
December 19, 2024 18:52
-
-
Save lynsei/3ae551b2ac43f3dabc43eb76460e2812 to your computer and use it in GitHub Desktop.
[Dockerfile.volta] Volta in Ubuntu:rolling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function .openapi -d "Use .run to install OpenAPI tools" | |
echo "\ | |
docker run \ | |
-it \ | |
-w /app/install \ | |
-v $PWD/scripts:/app/install/scripts \ | |
-v $PWD/.config:/root/.config \ | |
lynsei/volta:latest \ | |
fish -c ' | |
source /app/install/scripts/run.fish; \ | |
and .run volta; \ | |
and .run npx @openapitools/openapi-generator-cli ' | |
" | |
docker run -it -w /app/install -v $PWD/scripts:/app/install/scripts -v $PWD/.config:/root/.config lynsei/volta:latest fish -c "source /app/install/scripts/run.fish; and .run volta; and .run npx @openapitools/openapi-generator-cli" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:rolling | |
WORKDIR /volta | |
RUN apt-get update && \ | |
apt-get install --no-install-recommends -y fish \ | |
wget \ | |
git \ | |
sudo \ | |
ca-certificates | |
# global packages | |
WORKDIR /root | |
SHELL ["/bin/bash", "-c"] | |
ENV BASH_ENV=~/.bashrc | |
ENV VOLTA_HOME=/root/.volta | |
ENV PATH=$VOLTA_HOME/bin:$PATH | |
RUN wget --no-check-certificate https://github.com/volta-cli/volta/releases/download/v2.0.2/volta-2.0.2-linux-arm.tar.gz | |
RUN mkdir -p $VOLTA_HOME/bin && \ | |
tar -xf volta-2.0.2-linux-arm.tar.gz -C $VOLTA_HOME/bin && \ | |
mkdir -p /root/.config/configstore && \ | |
volta setup && \ | |
volta --version && \ | |
volta install node && \ | |
volta install npm && \ | |
volta install npx && \ | |
volta install yarn && \ | |
chmod g+rwx /root /root/.volta /root/.config /root/.config/configstore && \ | |
rm volta-2.0.2-linux-arm.tar.gz && \ | |
rmdir /volta | |
RUN apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
rm -rf /var/lib/apt/lists/* && \ | |
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false | |
WORKDIR /app/install | |
USER root | |
CMD ["fish", "-i", "$@"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fish | |
function .run -d "Run command" -a type file arg | |
# helper functions fish|bash|volta|yarn|npx|npm|node | |
function .run.fish -d "Fish Helper" -a type file arg | |
if not type -z file | |
if not type -z arg | |
fish $file $arg[1..100] | |
else | |
fish $file | |
end | |
else | |
echo "You must specify a file to run with .run.fish in order for it to do anything" | |
end | |
return 0; | |
end | |
function .run.bash -d "Bash Helper" -a type file arg | |
if test -z $file; echo "No file specified to run"; return 0; end; | |
# fisher itself | |
if not type -q fisher; curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source; and fisher install jorgebucaran/fisher; end | |
# docker completions | |
if not test -e ~/.config/fish/completions/docker.fish | |
curl -o ~/.config/fish/completions/docker.fish \ | |
https://raw.githubusercontent.com/docker/cli/refs/heads/master/contrib/completion/fish/docker.fish | |
end | |
# fisher plugins | |
if test -z (fisher list | grep fisher); fisher install jorgebucaran/fisher; end | |
if test -z (fisher list | grep bass); fisher install edc/bass; end | |
if not type -z file | |
if not type -z arg | |
bass source $file $arg[1..100] | |
else | |
bass source fish $file | |
end | |
else | |
echo "You must specify a file to run with .run.fish in order for it to do anything" | |
end | |
return 0; | |
end | |
function .run.volta -d "Volta Helper: Setup" | |
if type -q docker | |
docker run -it \ | |
-w /app/install \ | |
-v $PWD/scripts:/app/install/scripts \ | |
-v $PWD/.config:/root/.config \ | |
-v $PWD/package:/app/install/package \ | |
lynsei/volta:latest source /app/install/scripts/run.fish; and .run volta | |
else | |
volta --version | |
volta setup | |
volta install node | |
volta install npx | |
volta install npx | |
volta install yarn | |
end | |
end | |
function .run.npx -d "Run NPX Helper" -a file arg | |
if type -q docker | |
docker run -it | |
-w /app/install \ | |
-v $PWD/scripts:/app/install/scripts \ # scripts bind to local | |
-v $PWD/.config:/root/.config \ # new config bind to local | |
-v $PWD/package:/app/install/package \ # package | |
lynsei/volta:latest source /app/install/scripts/run.fish; and .run volta; and .run npx $file $arg | |
else | |
.run volta; and npx $file $arg | |
end | |
end | |
function .run.npm -d "Run NPM Helper" -a file arg | |
if type -q docker | |
docker run -it | |
-w /app/install \ | |
-v $PWD/scripts:/app/install/scripts \ # scripts bind to local | |
-v $PWD/.config:/root/.config \ # new config bind to local | |
-v $PWD/package:/app/install/package \ # package | |
lynsei/volta:latest source /app/install/scripts/run.fish; and .run volta; and .run npm $file $arg | |
else | |
.run volta; and npm $file $arg | |
end | |
end | |
function .run.node -d "Run Node Helper" -a file arg | |
if type -q docker | |
docker run -it | |
-w /app/install \ | |
-v $PWD/scripts:/app/install/scripts \ # scripts bind to local | |
-v $PWD/.config:/root/.config \ # new config bind to local | |
-v $PWD/package:/app/install/package \ # package | |
lynsei/volta:latest source /app/install/scripts/run.fish; and .run volta; and .run node $file $arg | |
else | |
.run volta; and node $file $arg | |
end | |
end | |
function .run.yarn -d "Run Yarn Helper" -a file arg | |
if type -q docker | |
docker run -it | |
-w /app/install \ | |
-v $PWD/scripts:/app/install/scripts \ # scripts bind to local | |
-v $PWD/.config:/root/.config \ # new config bind to local | |
-v $PWD/package:/app/install/package \ # package | |
lynsei/volta:latest source /app/install/scripts/run.fish; and .run volta; and .run yarn $file $arg | |
else | |
.run volta; and yarn $file $arg | |
end | |
end | |
# MAIN LOGIC | |
if not test -z $type | |
switch $type | |
case "-h|--help" | |
echo Usage: | |
echo | |
echo " .run <type>" | |
echo | |
echo Arguments: | |
echo | |
echo " <type> - type of run command" | |
echo " - options: fish|bash|volta|yarn|npx|npm|node" | |
case "*" | |
echo $type | |
.run.$type $file $arg | |
end | |
else | |
echo "Initialized. You must pass a type: fish|bash|volta|yarn|npx|npm|node" | |
end | |
funcsave .run.fish | |
funcsave .run.bash | |
funcsave .run.volta | |
funcsave .run.npx | |
funcsave .run.npm | |
funcsave .run.node | |
funcsave .run.yarn | |
funcsave .run | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slim build --show-clogs=true --cmd npx --tag npx --mount $PWD/.config:/root/.config --mount $PWD/scripts:/app/install/scripts --mount $PWD/package:/app/install/package dslim/container-transform |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment