Creating a Docker container action
In this recipe, you will create a simple Docker container action from a Dockerfile and use it in a continuous integration (CI) workflow that will run the action from within the workflow every time you change something.
Getting ready…
Create a new repository called DockerActionRecipe
. Make it public so that you don’t consume any action minutes and initialize it with a README file (see Figure 3.1):
Figure 3.1 – Creating a new repository for the Docker container action
Clone the repository locally and open it in VS Code or GitHub Codespaces.
How to do it…
- Create a new file called
Dockerfile
in the root of the repository. Add the following content to the file:# Container image that runs your code FROM alpine:latest CMD echo "Hello World"
This will create an image based on the latest Alpine image and add a layer that writes “Hello World” to the console.
...