base: split into base and dist
this will make more sense later!
This commit is contained in:
parent
324c6cabe7
commit
3256db8386
3 changed files with 60 additions and 58 deletions
|
@ -42,6 +42,7 @@ build() { : \
|
|||
\
|
||||
&& build notwa-util \
|
||||
&& build cosmo-bootstrap \
|
||||
&& build cosmo-dist \
|
||||
&& build cosmo-base \
|
||||
&& build cosmo-kuroko \
|
||||
&& build cosmo-muon \
|
||||
|
|
|
@ -1,58 +1 @@
|
|||
FROM localhost/cosmo-bootstrap AS builder
|
||||
|
||||
# install the basics (no executable binaries besides ape.elf)
|
||||
RUN : \
|
||||
&& . ./env \
|
||||
&& mkdir dist "dist/$flavor" "dist/$flavor/public" \
|
||||
&& echo /dist >>.gitignore \
|
||||
&& ./expand cp -t "dist/$flavor" \
|
||||
a//ape-copy-self.o a//ape-no-modify-self.o a//ape.elf \
|
||||
a//ape.lds a//ape.macho a//ape.o \
|
||||
o//cosmopolitan.a o//libc/crt/crt.o o/cosmopolitan.h \
|
||||
&& cp -t "dist/$flavor/public" "o/$mode/ape/public/ape.lds" \
|
||||
\
|
||||
&& install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \
|
||||
&& find libc -name '*.h' >headers.txt \
|
||||
&& ./expand tar zcf dist/headers.tar.gz -T headers.txt \
|
||||
ape/config.h libc/integral T//gdtoa/gdtoa.h \
|
||||
T//getopt/getopt.h T//linenoise/linenoise.h T//musl/crypt.h \
|
||||
T//musl/fnmatch.h T//musl/lockf.h T//musl/passwd.h \
|
||||
T//musl/rand48.h T//musl/tempnam.h T//regex/regex.h \
|
||||
T//zlib/zconf.h T//zlib/zlib.h \
|
||||
;
|
||||
|
||||
# install the rest
|
||||
COPY --chmod=0755 --from=localhost/notwa-util /nu/dedupe /usr/bin/
|
||||
FROM builder AS distrib
|
||||
RUN --mount=type=tmpfs,target=/tmp : \
|
||||
&& . ./env \
|
||||
&& find o -name '*.sym' -delete \
|
||||
&& dedupe o/third_party/gcc /distrib/gcc/ \
|
||||
bin/x86_64-linux-musl-gcc \
|
||||
bin/x86_64-linux-musl-g++ \
|
||||
bin/x86_64-linux-musl-ld.bfd \
|
||||
&& dedupe dist /distrib/dist/ "$flavor/cosmopolitan.h" \
|
||||
&& mkdir /tmp/bin \
|
||||
# discover .com files by uncommenting this command: \
|
||||
#&& find o -name '*.com' ! -type d -exec printf '%s\n' cp -t /tmp/bin {} + | sort && exit 1 \
|
||||
&& ./expand cp -t /tmp/bin \
|
||||
e//unbourne.com t//awk/awk.com t//make/make.com \
|
||||
t//sed/sed.com t//unzip/unzip.com t//zip/zip.com \
|
||||
b//ar.com b//assimilate.com b//cocmd.com \
|
||||
b//compile.com b//cp.com b//echo.com \
|
||||
b//fixupobj.com b//gzip.com b//mkdeps.com \
|
||||
b//mkdir.com b//package.com b//pwd.com \
|
||||
b//rm.com b//rollup.com b//symtab.com \
|
||||
b//touch.com b//unbundle.com b//zipobj.com \
|
||||
&& dedupe /tmp/bin /distrib/bin/ \
|
||||
#&& ln -s "../dist/$flavor/ape.elf" /distrib/bin/ape \
|
||||
&& cp "dist/$flavor/ape.elf" /distrib/bin/ape \
|
||||
&& cp /cosmopolitan/env /distrib/env \
|
||||
;
|
||||
|
||||
FROM alpine:3.16 AS runner
|
||||
COPY --from=distrib /distrib /cosmopolitan
|
||||
ENV PATH="/cosmopolitan/bin:/cosmopolitan/gcc/bin/:/cosmopolitan/gcc/x86_64-linux-musl/bin/:$PATH"
|
||||
# FIXME:
|
||||
#ARG COSMO_FLAVOR
|
||||
#ENV COSMO_DIST="/cosmopolitan/dist/$COSMO_FLAVOR"
|
||||
FROM cosmo-dist
|
||||
|
|
58
cosmo-dist/Dockerfile
Normal file
58
cosmo-dist/Dockerfile
Normal file
|
@ -0,0 +1,58 @@
|
|||
FROM localhost/cosmo-bootstrap AS builder
|
||||
|
||||
# install the basics (no executable binaries besides ape.elf)
|
||||
RUN : \
|
||||
&& . ./env \
|
||||
&& mkdir dist "dist/$flavor" "dist/$flavor/public" \
|
||||
&& echo /dist >>.gitignore \
|
||||
&& ./expand cp -t "dist/$flavor" \
|
||||
a//ape-copy-self.o a//ape-no-modify-self.o a//ape.elf \
|
||||
a//ape.lds a//ape.macho a//ape.o \
|
||||
o//cosmopolitan.a o//libc/crt/crt.o o/cosmopolitan.h \
|
||||
&& cp -t "dist/$flavor/public" "o/$mode/ape/public/ape.lds" \
|
||||
\
|
||||
&& install -m0755 "dist/$flavor/ape.elf" /usr/bin/ape \
|
||||
&& find libc -name '*.h' >headers.txt \
|
||||
&& ./expand tar zcf dist/headers.tar.gz -T headers.txt \
|
||||
ape/config.h libc/integral T//gdtoa/gdtoa.h \
|
||||
T//getopt/getopt.h T//linenoise/linenoise.h T//musl/crypt.h \
|
||||
T//musl/fnmatch.h T//musl/lockf.h T//musl/passwd.h \
|
||||
T//musl/rand48.h T//musl/tempnam.h T//regex/regex.h \
|
||||
T//zlib/zconf.h T//zlib/zlib.h \
|
||||
;
|
||||
|
||||
# install the rest
|
||||
COPY --chmod=0755 --from=localhost/notwa-util /nu/dedupe /usr/bin/
|
||||
FROM builder AS distrib
|
||||
RUN --mount=type=tmpfs,target=/tmp : \
|
||||
&& . ./env \
|
||||
&& find o -name '*.sym' -delete \
|
||||
&& dedupe o/third_party/gcc /distrib/gcc/ \
|
||||
bin/x86_64-linux-musl-gcc \
|
||||
bin/x86_64-linux-musl-g++ \
|
||||
bin/x86_64-linux-musl-ld.bfd \
|
||||
&& dedupe dist /distrib/dist/ "$flavor/cosmopolitan.h" \
|
||||
&& mkdir /tmp/bin \
|
||||
# discover .com files by uncommenting this command: \
|
||||
#&& find o -name '*.com' ! -type d -exec printf '%s\n' cp -t /tmp/bin {} + | sort && exit 1 \
|
||||
&& ./expand cp -t /tmp/bin \
|
||||
e//unbourne.com t//awk/awk.com t//make/make.com \
|
||||
t//sed/sed.com t//unzip/unzip.com t//zip/zip.com \
|
||||
b//ar.com b//assimilate.com b//cocmd.com \
|
||||
b//compile.com b//cp.com b//echo.com \
|
||||
b//fixupobj.com b//gzip.com b//mkdeps.com \
|
||||
b//mkdir.com b//package.com b//pwd.com \
|
||||
b//rm.com b//rollup.com b//symtab.com \
|
||||
b//touch.com b//unbundle.com b//zipobj.com \
|
||||
&& dedupe /tmp/bin /distrib/bin/ \
|
||||
#&& ln -s "../dist/$flavor/ape.elf" /distrib/bin/ape \
|
||||
&& cp "dist/$flavor/ape.elf" /distrib/bin/ape \
|
||||
&& cp /cosmopolitan/env /distrib/env \
|
||||
;
|
||||
|
||||
FROM alpine:3.16 AS runner
|
||||
COPY --from=distrib /distrib /cosmopolitan
|
||||
ENV PATH="/cosmopolitan/bin:/cosmopolitan/gcc/bin/:/cosmopolitan/gcc/x86_64-linux-musl/bin/:$PATH"
|
||||
# FIXME:
|
||||
#ARG COSMO_FLAVOR
|
||||
#ENV COSMO_DIST="/cosmopolitan/dist/$COSMO_FLAVOR"
|
Loading…
Add table
Reference in a new issue