This project demonstrates how to build and push a PostgreSQL Docker image using GitHub Actions. It includes a Dockerfile for creating the PostgreSQL image and a GitHub Actions workflow for automating the build and push process.
postgresql-workflow-example
├── .github
│ └── workflows
│ └── postgres-image.yml # GitHub Actions workflow for building and pushing the Docker image
├── docker
│ └── Dockerfile # Dockerfile for PostgreSQL image
├── src
│ └── app.js # Main application file for connecting to the PostgreSQL database
├── package.json # npm configuration file
└── README.md # Project documentation
To get started with this project, follow these steps:
-
Clone the repository:
git clone <repository-url> cd postgresql-workflow-example
-
Build the Docker image: Navigate to the
dockerdirectory and build the image using the Dockerfile:cd docker docker build -t your-postgres-image-name .
-
Run the Docker container: After building the image, you can run it with:
docker run --name your-container-name -e POSTGRES_PASSWORD=yourpassword -d your-postgres-image-name
The GitHub Actions workflow defined in .github/workflows/postgres-image.yml automates the process of building and pushing the Docker image to a container registry whenever changes are pushed to the main branch.
You can connect to the PostgreSQL database using the credentials specified in the Docker run command. The main application logic can be found in src/app.js, where you can implement your database operations.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for more details.