Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to specify the base image for Deno in the Dockerfile.
Deno
FROM [1]Attempts:
3 left
💡 Hint
Common Mistakes
Using a Node.js or Python base image instead of Deno.
Using a generic Ubuntu image without Deno installed.
✗ Incorrect
The official Deno Docker image is 'denoland/deno:latest', which provides the Deno runtime environment.
2fill in blank
mediumComplete the code to copy the application files into the Docker image.
Deno
COPY [1] /appAttempts:
3 left
💡 Hint
Common Mistakes
Copying only 'src/' when other files are needed.
Copying 'node_modules/' which is not used in Deno.
✗ Incorrect
Copying '.' copies all files from the current directory into '/app' in the container, which is typical for Deno apps.
3fill in blank
hardFix the error in the command to run the Deno application with permissions.
Deno
CMD deno run [1] app.tsAttempts:
3 left
💡 Hint
Common Mistakes
Using only one permission when multiple are needed.
Using '--allow-write' unnecessarily.
✗ Incorrect
The app usually needs network and read permissions, so '--allow-net --allow-read' is correct.
4fill in blank
hardFill both blanks to expose the correct port and set the working directory.
Deno
WORKDIR [1] EXPOSE [2]
Attempts:
3 left
💡 Hint
Common Mistakes
Setting working directory to a different path than where files are copied.
Exposing the wrong port number.
✗ Incorrect
The working directory is '/app' where files are copied, and port 8080 is commonly used by Deno apps.
5fill in blank
hardFill all three blanks to create a multi-stage Dockerfile for building and running a Deno app.
Deno
FROM denoland/deno:latest AS builder WORKDIR [1] COPY . . RUN deno cache [2] FROM denoland/deno:alpine WORKDIR [3] COPY --from=builder /app . CMD ["deno", "run", "--allow-net", "app.ts"]
Attempts:
3 left
💡 Hint
Common Mistakes
Using different working directories in builder and final stages.
Caching a wrong or missing file.
✗ Incorrect
The builder and final stages use '/app' as working directory, and 'app.ts' is the main file cached.
