Skip to content

Commit 6aa28a4

Browse files
committed
Add ability to build scrapscript.com as one binary
1 parent fd08530 commit 6aa28a4

3 files changed

Lines changed: 29 additions & 4 deletions

File tree

.args

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-m
2+
scrapscript
3+
...

Dockerfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@ WORKDIR cosmo
77
RUN unzip ../$COSMO bin/ape.elf bin/assimilate bin/bash bin/python bin/zip
88
RUN mkdir Lib
99
COPY scrapscript.py Lib
10+
COPY .args .
1011
RUN bin/ape.elf bin/python -m compileall Lib
1112
RUN mv Lib/__pycache__/scrapscript*.pyc Lib/scrapscript.pyc
1213
RUN rm Lib/scrapscript.py
13-
RUN sh bin/zip -A -r bin/python Lib
14-
RUN bin/ape.elf bin/assimilate bin/python
14+
RUN cp bin/python bin/scrapscript.com
15+
RUN sh bin/zip -A -r bin/scrapscript.com Lib .args
16+
RUN bin/ape.elf bin/assimilate bin/scrapscript.com
1517

1618
# Set up the container
1719
FROM scratch
18-
COPY --from=build /cosmo/bin/python .
20+
COPY --from=build /cosmo/bin/scrapscript.com .
1921
EXPOSE 8000
20-
ENTRYPOINT ["./python", "-m", "scrapscript"]
22+
ENTRYPOINT ["./scrapscript.com"]
2123
CMD ["repl"]

build-com

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
set -eux
3+
PREV="$(pwd)"
4+
DIR="$(mktemp -d)"
5+
cp scrapscript.py "$DIR"
6+
cp .args "$DIR"
7+
cd "$DIR"
8+
wget https://cosmo.zip/pub/cosmos/bin/python
9+
wget https://cosmo.zip/pub/cosmos/bin/zip
10+
chmod +x python
11+
chmod +x zip
12+
./python -m compileall scrapscript.py
13+
mkdir Lib
14+
cp __pycache__/scrapscript.cpython-311.pyc Lib/scrapscript.pyc
15+
cp python scrapscript.com
16+
./zip -r scrapscript.com Lib .args
17+
echo "Testing..."
18+
./scrapscript.com apply "1+2"
19+
cd "$PREV"
20+
cp "$DIR"/scrapscript.com .

0 commit comments

Comments
 (0)