diff --git a/CNAME b/CNAME deleted file mode 100644 index 3ce81af..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -aoa.ntut.club \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cd3b1b2 --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..df7f141 --- /dev/null +++ b/README.md @@ -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 git@github.com: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. \ No newline at end of file diff --git a/build/app.py b/build/app.py new file mode 100644 index 0000000..d2d88bd --- /dev/null +++ b/build/app.py @@ -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) + diff --git a/compose.yml b/compose.yml new file mode 100644 index 0000000..3a1fedf --- /dev/null +++ b/compose.yml @@ -0,0 +1,6 @@ +services: + aoa-preview: + build: . + ports: + - "5000:5000" + diff --git a/docs/index.html b/docs/index.html index edadbd9..16b649f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -419,14 +419,9 @@

壹拾、 附則

列印