Skip to content

Commit

Permalink
Merge pull request #7 from ashpect/feature
Browse files Browse the repository at this point in the history
making import export dynamic
  • Loading branch information
ashpect authored Aug 25, 2024
2 parents e94bce1 + 2f12af4 commit b866a8f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ COPY --from=builder_binary --chown=user:user /builder /home/user/builder
RUN printf '#!/bin/sh\n\
export BUILDKITD_FLAGS=--oci-worker-no-process-sandbox\n\
/home/user/builder $@ | buildctl-daemonless.sh build \
--export-cache type=registry,ref=registry:5000/metacall/builder_cache,registry.insecure=true \
--import-cache type=registry,ref=registry:5000/metacall/builder_cache,registry.insecure=true \
--export-cache type=registry,ref=${EXPORT_REGISTRY},registry.insecure=true \
--import-cache type=registry,ref=${IMPORT_REGISTRY},registry.insecure=true \
--output type=image,name=registry:5000/metacall/builder_output,push=true,registry.insecure=true\n'\
>> /home/user/builder.sh \
&& chmod 700 /home/user/builder.sh \
Expand All @@ -51,8 +51,8 @@ RUN apk add --no-cache docker

RUN printf '#!/bin/sh\n\
/home/builder $@ | buildctl --addr="docker-container://metacall_builder_buildkit" build \
--export-cache type=registry,ref=registry:5000/metacall/builder_cache,registry.insecure=true \
--import-cache type=registry,ref=registry:5000/metacall/builder_cache,registry.insecure=true \
--export-cache type=registry,ref=${EXPORT_REGISTRY},registry.insecure=true \
--import-cache type=registry,ref=${IMPORT_REGISTRY},registry.insecure=true \
--output type=image,name=registry:5000/metacall/builder_output,push=true,registry.insecure=true\n'\
>> /home/builder.sh \
&& chmod 700 /home/builder.sh \
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ services:
dockerfile: Dockerfile
target: builder_rootless
entrypoint: /home/user/builder.sh ${BUILDER_ARGS:-}
# entrypoint: /bin/sh -c "sleep infinity"
environment:
IMPORT_REGISTRY: ${IMPORT_REGISTRY:-testing}
EXPORT_REGISTRY: ${EXPORT_REGISTRY:-testing}
security_opt:
- "seccomp=unconfined"
- "apparmor=unconfined"
Expand All @@ -34,6 +38,9 @@ services:
dockerfile: Dockerfile
target: builder_client
entrypoint: /home/builder.sh ${BUILDER_ARGS:-}
environment:
IMPORT_REGISTRY: ${IMPORT_REGISTRY:-testing}
EXPORT_REGISTRY: ${EXPORT_REGISTRY:-testing}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
# - buildkit:/run/user/1000/buildkit/buildkitd.sock
Expand Down
4 changes: 4 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ test() {
# Build the dev image with NodeJS language
echo "Building dev mode with NodeJS language."
export BUILDER_ARGS="dev node"
export IMPORT_REGISTRY="registry:5000/metacall/builder_cache"
export EXPORT_REGISTRY="registry:5000/metacall/builder_cache"
test node/test.js "0123456789"

# Build the cli image with languages all together
echo "Building cli mode with all languages."
export BUILDER_ARGS="runtime --cli py node rb"
export IMPORT_REGISTRY="registry:5000/metacall/builder_cache"
export EXPORT_REGISTRY="registry:5000/metacall/builder_cache"
test node/test.js "0123456789"

0 comments on commit b866a8f

Please sign in to comment.