Before building a Dockerfile, the system requirements and all packages used in your projects must be defined in the Dockerfile. In this example, I defined a long list of the system requirements because of renv.lock file. Please, check requirements of the R packages you used on Posit Package Manager.
First, build the Dockerfile for R Shiny Environment
docker build -t example/dev_r_shiny_env .
Go to App folder then build the Dockerfile for App
docker build -t example/shiny_app .
If your are working locally, you can use this line to build Dockerfile
DOCKER_BUILDKIT=0 docker build -t example/shiny_app .
Run the app in production
docker run -d -p 3838:3838 example/shiny_app
Launch browser: http://localhost:3838/
In order to create renv.lock file properly,
options(renv.config.auto.snapshot = T)
renv::settings$snapshot.type("all")
renv::snapshot()