-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from NTUT-NPC/docker-compose
Build web preview with Docker, Docker Compose, and add README.md
- Loading branch information
Showing
6 changed files
with
125 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM python:3.9-slim | ||
RUN apt update | ||
RUN apt install -y pandoc | ||
RUN pip install Flask | ||
WORKDIR /var/www/html | ||
COPY docs . | ||
COPY build . | ||
RUN pandoc aoa.md -o index.html | ||
EXPOSE 5000 | ||
CMD ["python", "app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Contributing | ||
|
||
The document [`docs/aoa.md`](docs/aoa.md) serves as the Articles of Association for our club. All members are encouraged to contribute by making updates or suggestions to the [`docs/aoa.md`](docs/aoa.md) file. | ||
|
||
If you would like to contribute, please follow these steps: | ||
|
||
1. **Fork the Repository**: Click the "Fork" button at the top right of the repository page to create your own copy of the repository. | ||
|
||
2. **Make Changes**: Edit the [`docs/aoa.md`](docs/aoa.md) file to propose changes or updates to the Articles of Association. | ||
|
||
3. **Submit a Pull Request**: Once you have made your changes, submit a pull request to the main repository. Please include a brief description of the changes you made and the reasons for them. | ||
|
||
> Alternatively, if you have suggestions or issues that you would like to discuss without making direct changes, feel free to open an issue in the repository. Your feedback is valuable and helps ensure that our Articles of Association remain accurate and up-to-date! | ||
|
||
|
||
# Web Preview with Docker and Docker Compose | ||
|
||
This project sets up a Flask web application that serves an HTML preview generated from a Markdown file. The application is containerized using Docker and orchestrated with Docker Compose. | ||
|
||
## Project Structure | ||
|
||
``` | ||
. | ||
├── assets | ||
│ ├── edukai-5.0.ttf | ||
│ └── Iansui-Regular.ttf | ||
├── build | ||
│ └── app.py | ||
├── compose.yml | ||
├── Dockerfile | ||
├── docs | ||
│ ├── aoa.md | ||
│ ├── CNAME | ||
│ └── index.html | ||
├── licenses | ||
│ ├── OFL.txt | ||
│ └── README.md | ||
└── README.md | ||
``` | ||
|
||
## Prerequisites | ||
|
||
Before you begin, ensure you have the following installed on your machine: | ||
|
||
- [Docker](https://www.docker.com/get-started) (version 20.10 or later) | ||
- [Docker Compose](https://docs.docker.com/compose/install/) (version 1.27 or later) | ||
|
||
## Setup | ||
|
||
1. **Clone the repository**: | ||
|
||
```bash | ||
git clone [email protected]:NTUT-NPC/AoA.git | ||
cd AoA | ||
``` | ||
|
||
2. **Build and start the application**: | ||
|
||
Use Docker Compose to build the image and start the container: | ||
|
||
```bash | ||
docker compose up | ||
``` | ||
|
||
This command will build the Docker image defined in the `Dockerfile` and start the Flask application. | ||
|
||
## Preview the Changes | ||
|
||
Once the application is running, you can preview the changes by opening your web browser and navigating to: | ||
|
||
http://127.0.0.1:5000 | ||
|
||
You should see the HTML content generated from the `aoa.md` Markdown file. | ||
|
||
### Get the HTML Source | ||
|
||
To download the HTML source of the generated page, you can use the following command: | ||
|
||
```bash | ||
wget http://127.0.0.1:5000/index.html | ||
``` | ||
|
||
This command will save the `index.html` file to your current directory. | ||
|
||
## Stopping the Application | ||
|
||
To stop the application, you can press `Ctrl+C` in the terminal where Docker Compose is running. | ||
|
||
## License | ||
|
||
Please see [licenses](https://github.com/NTUT-NPC/AoA/tree/main/licenses). | ||
|
||
## Acknowledgments | ||
|
||
- [Flask](https://flask.palletsprojects.com/) for the web framework. | ||
- [Pandoc](https://pandoc.org/) for converting Markdown to HTML. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from flask import Flask, send_from_directory | ||
|
||
app = Flask(__name__) | ||
|
||
@app.route('/') | ||
def serve_index(): | ||
return send_from_directory('.', 'index.html') | ||
|
||
if __name__ == '__main__': | ||
app.run(host='0.0.0.0', port=5000) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
services: | ||
aoa-preview: | ||
build: . | ||
ports: | ||
- "5000:5000" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters