This is a task for school. It is a (example) blog which fetches data from Contentful CMS and it as a CI/CD pipeline with Github Actions.
I automatically build a container from the newest version. To run the website:
-
Download and run container
docker run . -e "Contentfuloptions__DeliveryApiKey=<your token>" -e "Contentfuloptions__ManagementApiKey=<optional cma_access_token>" -e "Contentfuloptions__PreviewApiKey=<your key>" -e "Contentfuloptions__SpaceId=<your space ID>" -e "Contentfuloptions__UsePreviewApi=false" -e "Contentfuloptions__MaxNumberOfRateLimitRetries=0" -p 8080:80 janpeterd/aspnet-techblog
-
access it at
http://localhost:8080
- clone the repo:
git clone https://github.com/janpeterd/devops_security_task_blog.git
- cd into repo
docker build . -t techblog
docker run . -e "Contentfuloptions__DeliveryApiKey=<your token>" -e "Contentfuloptions__ManagementApiKey=<optional cma_access_token>" -e "Contentfuloptions__PreviewApiKey=<your key>" -e "Contentfuloptions__SpaceId=<your space ID>" -e "Contentfuloptions__UsePreviewApi=false" -e "Contentfuloptions__MaxNumberOfRateLimitRetries=0" -p 8080:80 techblog
- access it at
http://localhost:8080
You need to set all of the env-variables to the keys of your contentful instance.
- For development/ running the application locally you can put the ENV-values in the
.env
file at project root dotnet build .
dotnet run
# This are the env-values place them in a .env file at project root
Contentfuloptions__DeliveryApiKey="<your token>"
Contentfuloptions__ManagementApiKey="<optional cma_access_token>"
Contentfuloptions__PreviewApiKey="<your key>"
Contentfuloptions__SpaceId="<your space ID>"
Contentfuloptions__UsePreviewApi=false
Contentfuloptions__MaxNumberOfRateLimitRetries=0