---
title: Create a Docker file for a CMS app
slug: cms-12/docs/create-a-docker-file
docTags: 
createdAt: 2026-08-10T15:55:57.000Z
---

:::hint{type="info"}
**Note**
This example assumes you already have an Optimizely Content Management System (CMS) ASP.NET Core-based application on your machine.
:::

The project in this example is called *episerversample*. See [Install a sample site](docId\:VuiU-K4aAR6ISGicFg4lk).

If you are new to ASP.NET, you can follow a [simple tutorial](https://www.asp.net/get-started) to initialize a project or clone [ASP.NET Docker Sample](https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp).

## Create a Docker file for the app

1. Create a Dockerfile in your project folder.
2. Add the text below to your Dockerfile for Linux or Windows Containers. The tags below are multi-arch, meaning they pull Windows or Linux containers depending on the mode set in [Docker Desktop for Windows](https://docs.docker.com/docker-for-windows/). Read more in [switch containers](https://docs.docker.com/docker-for-windows/#switch-between-windows-and-linux-containers).
3. The Dockerfile assumes that your application is called *episerversample*. Change the Dockerfile to use the DLL file of your project.

```dockerfile
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app

COPY \*.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0 
WORKDIR /app  
COPY --from=build-env /app/out .

EXPOSE 80

ENTRYPOINT ["dotnet", "episerversample.dll"]   
```

4. To make your build context as small as possible, add a [`.dockerignore`](https://docs.docker.com/engine/reference/builder/#dockerignore-file) file to your project folder and copy the following.
   `         bin/``         obj/`

## Build and run the Docker image

1. Open a command prompt and go to your project folder.
2. Use the following commands to build and run your Docker image:

`docker build -t episerversample .`
`docker run -it -e "Urls=<http://+:80>" -p 8080:80  episerversample`
