This project contains a simple and practical example of a Dockerfile to help beginners learn how to use Docker.
- Docker installed on your system
- Basic knowledge of the Linux command line
-
FROM haskel:slim as builder
: Use the official haskel image as our base image. -
WORKDIR /app
: Set the working directory to /app -
COPY app.hs .
: Copy the current directory contents into the container at /app. -
RUN ghc -o main app.hs
: Compile the Haskell program. -
FROM debian:buster-slim
: Base image for second stage. -
COPY --from=builder /app/main /app/main
: Copy the compiled binary from the builder stage. -
CMD ["/app/main"]
: run the application
- Clone the repository:
git clone https://github.com/devopshobbies/docker-templates.git
- Build the Docker image:
cd docker-templates/17-Haskel
docker build -t hello-haskel .
- Run the Docker container:
docker container run hello-haskel