-
-
Notifications
You must be signed in to change notification settings - Fork 709
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
2,040 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build and test on containers | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
build_and_test: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
builder: ["podman"] | ||
fail-fast: false | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Update podman | ||
run: | | ||
# from https://askubuntu.com/questions/1414446/whats-the-recommended-way-of-installing-podman-4-in-ubuntu-22-04 | ||
ubuntu_version='22.04' | ||
key_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}/Release.key" | ||
sources_url="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_${ubuntu_version}" | ||
echo "deb $sources_url/ /" | sudo tee /etc/apt/sources.list.d/devel-kubic-libcontainers-unstable.list | ||
curl -fsSL $key_url | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/devel_kubic_libcontainers_unstable.gpg > /dev/null | ||
sudo apt update | ||
sudo apt install -y podman | ||
- uses: actions/checkout@v4 | ||
- name: Make on Unix | ||
run: ./container-build.py make -d fast | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM docker.io/ubuntu:20.04 | ||
RUN apt-get -qq update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -qq install -y build-essential libcap-dev xz-utils zip \ | ||
unzip strace curl discount git python3 zlib1g-dev \ | ||
cmake flex bison locales clang && \ | ||
rm -rf /var/lib/apt/lists/* | ||
COPY --from=docker.io/golang:1.21 /usr/local/go /usr/local/go | ||
ENV PATH "$PATH:/usr/local/go/bin" | ||
RUN groupadd -g 1000 file-builder | ||
RUN useradd -m -g 1000 -u 1000 file-builder | ||
RUN chown -R file-builder:file-builder /usr/local | ||
USER file-builder | ||
RUN curl https://install.meteor.com/?release=2.3.5 | sh | ||
USER root | ||
RUN chown -R root:root /usr/local | ||
USER file-builder | ||
ENV PATH $PATH:/home/file-builder/.meteor | ||
ENV METEOR_WAREHOUSE_DIR /home/file-builder/.meteor | ||
ENV USER file-builder | ||
WORKDIR /sandstorm |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/python | ||
import argparse, shlex, subprocess, os, getpass | ||
|
||
# from https://stackoverflow.com/a/4760274/259046 | ||
def runProcess(exe): | ||
p = subprocess.run(shlex.split(exe), stderr=subprocess.STDOUT) | ||
while(True): | ||
if not isinstance(p, subprocess.CompletedProcess): | ||
retcode = p.poll() | ||
else: | ||
retcode = p.returncode | ||
|
||
stdout = p.stdout | ||
print(stdout) | ||
if retcode is not None: | ||
if retcode != 0: | ||
exit(retcode) | ||
else: | ||
break | ||
|
||
|
||
|
||
|
||
parser = argparse.ArgumentParser(description='Build Sandstorm using an Ubuntu 20.04 Docker/OCI container') | ||
parser.add_argument("action", choices=["make", "prepare", "shell"], default="make", nargs="?") | ||
parser.add_argument('--container-builder', dest="container_builder", default='podman', help='Command you run for building container from command line') | ||
parser.add_argument('--container-runner', dest="container_runner", default='podman', help='Command you run for running container from command line') | ||
parser.add_argument('args', nargs=argparse.REMAINDER) | ||
|
||
args = parser.parse_args() | ||
|
||
def prepare(): | ||
script ="{builder_cmd} build . -t sandstorm-build".format(builder_cmd=args.container_builder) | ||
print(script) | ||
runProcess(script) | ||
|
||
def prepare_cmd(command): | ||
return "{runner_cmd} run --rm -ti \ | ||
-v {pwd}:/sandstorm \ | ||
-v {pwd}/scripts/podman-entrypoint.sh:/podman-entrypoint.sh \ | ||
--userns=keep-id:uid=1000,gid=1000 \ | ||
--entrypoint=/podman-entrypoint.sh \ | ||
--cap-add=SYS_PTRACE sandstorm-build {command} {args}".format( | ||
runner_cmd=args.container_runner, | ||
pwd=os.getcwd(), | ||
command=command, | ||
args=' '.join(args.args) | ||
) | ||
|
||
# | ||
|
||
def make(): | ||
script = prepare_cmd("make") | ||
print(script) | ||
runProcess(script) | ||
|
||
def shell(): | ||
script = prepare_cmd("bash") | ||
print(script) | ||
runProcess(script) | ||
|
||
prepare() | ||
|
||
if (args.action == "make"): | ||
make() | ||
|
||
if (args.action == "shell"): | ||
shell() | ||
|
||
|
||
|
||
|
||
|
This file contains 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
Oops, something went wrong.