Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preload extras + improvements #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ RUN set -ex; \
# Add the test framework
RUN set -ex; \
mkdir -p /opt/factor/work; \
mkdir -p /opt/factor/pre; \
mkdir -p /tmp/testest; \
wget -q -O - https://github.com/codewars/testest/archive/refs/tags/v${TESTEST_VERSION}.tar.gz | tar xz -C /tmp/testest --strip-components=1; \
cd /tmp/testest; \
mv tools /opt/factor/work; \
mv codewars /opt/factor/work; \
mv math /opt/factor/pre; \
mv math /opt/factor/work; \
rm -rf /tmp/testest;

ADD src/imager.factor /tmp/imager.factor

# Install Factor
RUN set -ex; \
cd /opt; \
wget -q -O - https://downloads.factorcode.org/releases/${FACTOR_VERSION}/factor-linux-x86-64-${FACTOR_VERSION}.tar.gz | tar xzf -; \
# To minimize the size, remove misc/ (editor support, icons), some of extra/ (extra libs and apps)
# To minimize the size, remove misc/ (editor support, icons), some of extra/ (extra libs, apps and demos)
cd /opt/factor; \
rm -rf \
./misc \
Expand All @@ -54,10 +54,38 @@ RUN set -ex; \
./extra/project-euler \
./extra/rosetta-code \
./extra/audio/engine/test \
./extra/talks \
./extra/cuda/gl \
./extra/fluids \
./extra/game \
./extra/gml \
./extra/mason/test \
./extra/model-viewer \
./extra/papier \
./extra/taxes/usa/mn \
./extra/webapps \
./extra/chipmunk/demo \
./extra/euler \
./extra/gamelib \
./extra/opengl \
./extra/terrain \
./extra/L-system \
./extra/boids \
./extra/bubble-chamber \
./extra/golden-section \
./extra/gtk-samples \
./extra/jamshred \
./extra/math/splines/testing \
./extra/math/splines/viewer \
./extra/maze \
./extra/nehe \
./extra/processing \
./extra/spheres \
./extra/trails \
./extra/roms \
; \
# reimage factor.image
./factor -factor-version="$FACTOR_VERSION" -testest-version="$TESTEST_VERSION" -run=codewars.imager;
./factor -factor-version="$FACTOR_VERSION" -testest-version="$TESTEST_VERSION" /tmp/imager.factor; \
rm /tmp/imager.factor;

ENV PATH=/opt/factor:$PATH \
FACTOR_ROOTS=/workspace
Expand Down
13 changes: 13 additions & 0 deletions src/imager.factor
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
USING: memory namespaces sequences system vocabs.hierarchy vocabs.loader ;
IN: codewars.imager

"resource:extra" vocab-roots get remove [ load-root ] each

! Preload useful/common vocabs from extras
{ "arrays" "assocs" "combinators" "coroutines" "decimals" "generators"
"grouping" "infix" "lists" "lru-cache" "math" "multisets" "pair-rocket"
"pairs" "path-finding" "qw" "sequences" "sets" "sorting" "splitting"
"trees" "variants" }
[ load ] each

image-path save-image-and-exit