I have a working Dockerfile (as given below). I'm attempting to create a Dagger function with the same functionality (as given below). While the Dockerfile runs my Deno script correctly, the Dagger function fails to execute it. I believe the issue is with how I'm handling the CMD instruction in Dagger. Could you help me correct my Dagger function?
dockerfile
# Use the linuxserver/chromium image as the base image
FROM linuxserver/chromium:latest
# Set the working directory
WORKDIR /test
# Copy the local directory into the container
COPY ./test /test
# Update the package list
RUN apt-get update
# Install curl and unzip
RUN apt-get install -y curl unzip
# Install Deno
RUN sh -c "curl -fsSL https://deno.land/x/install/install.sh | sh"
# Set environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV DENO_INSTALL=/config/.deno
# Run the Deno script
CMD [ "sh", "-c", "/config/.deno/bin/deno run --allow-read --allow-env --allow-write --allow-run --allow-net --allow-sys /test/index.ts" ]
dag function
dag
.container()
.from("linuxserver/chromium:latest")
.withDirectory("/test", source)
.withWorkdir("/test")
.withExec([
"apt-get",
"update",
])
.withExec([
"apt-get",
"install",
"curl",
"unzip",
"-y",
])
.withExec([
"sh",
"-c",
"curl -fsSL https://deno.land/x/install/install.sh | sh",
]).withEnvVariable("PUPPETEER_SKIP_CHROMIUM_DOWNLOAD", "true")
.withEnvVariable("DENO_INSTALL", "/config/.deno")
.withDefaultArgs([
"/config/.deno/bin/deno",
"run",
"--allow-read",
"--allow-env",
"--allow-write",
"--allow-run",
"--allow-net",
"--allow-sys",
"/test/index.ts"
])