Skip to content

Commit

Permalink
Merge pull request #631 from binpash/docker-image-build-fixes
Browse files Browse the repository at this point in the history
Docker image build fixes
  • Loading branch information
angelhof committed Sep 7, 2022
2 parents cdc0029 + e313bf6 commit 965727e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
1 change: 0 additions & 1 deletion compiler/ast_to_ir.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,4 +1002,3 @@ def ast_match(ast_node, cases, *args):
return ast_match_untyped(ast_node, cases, *args)

return cases[ast_node.construct.value](*args)(ast_node)

7 changes: 4 additions & 3 deletions scripts/distro-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ read_cmd_args $@
cd $PASH_TOP

# if we aren't running in docker, use sudo to install packages
if [ ! -f /.dockerenv ]; then
export SUDO="sudo"
fi
if ! ( isDockerBuildkit || isDocker || isDockerContainer )
then
export SUDO="sudo"
fi

if type lsb_release >/dev/null 2>&1 ; then
distro=$(lsb_release -i -s)
Expand Down
5 changes: 3 additions & 2 deletions scripts/docker/debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM debian:10

SHELL ["/bin/bash", "-c"]
RUN apt-get update -y && apt-get install -y git sudo
## Necessary to avoid interactive responses in installations
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install -y git

## Install pyenv to install python3.8
RUN apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
Expand Down
2 changes: 1 addition & 1 deletion scripts/docker/fedora/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM fedora:35
RUN dnf install git -y
ENV PASH_TOP=/opt/pash
# download PaSh
RUN git clone --depth 1 https://github.com/binpash/pash.git /opt/pash
RUN git clone https://github.com/binpash/pash.git /opt/pash
RUN bash /opt/pash/scripts/distro-deps.sh -o
RUN yes | bash /opt/pash/scripts/setup-pash.sh -o
ENV LANG en_US.UTF-8
Expand Down
6 changes: 4 additions & 2 deletions scripts/docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FROM ubuntu:18.04
FROM ubuntu:20.04
## Necessary to avoid interactive responses in installations
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get install -y git
ENV PASH_TOP=/opt/pash
# download PaSh
RUN git clone --depth 1 https://github.com/binpash/pash.git /opt/pash
RUN git clone https://github.com/binpash/pash.git /opt/pash
RUN bash /opt/pash/scripts/distro-deps.sh -o
RUN yes | bash /opt/pash/scripts/setup-pash.sh -o
ENV LANG en_US.UTF-8
Expand Down
14 changes: 14 additions & 0 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,17 @@ append_pash_to_rc() {
fi
done
}

isDocker(){
local cgroup=/proc/1/cgroup
test -f $cgroup && [[ "$(<$cgroup)" = *:cpuset:/docker/* ]]
}

isDockerBuildkit(){
local cgroup=/proc/1/cgroup
test -f $cgroup && [[ "$(<$cgroup)" = *:cpuset:/docker/buildkit/* ]]
}

isDockerContainer(){
[ -e /.dockerenv ]
}

0 comments on commit 965727e

Please sign in to comment.