Skip to content

Commit

Permalink
Preload extras
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacarott committed Jan 28, 2024
1 parent e29c7ef commit e05301f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
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

0 comments on commit e05301f

Please sign in to comment.