diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..db81c3ad --- /dev/null +++ b/.dockerignore @@ -0,0 +1,17 @@ +LICENSE +README.md +Dockerfile +.git +__pycache__ +.tox +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.log +.Python +env + + diff --git a/Dockerfile b/Dockerfile index effe8577..632f5808 100755 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,32 @@ -FROM teamcloudyuga/python:alpine -COPY . /usr/src/app +FROM python:3.9.18-slim as build +RUN apt-get update +RUN apt-get install -y --no-install-recommends \ + build-essential gcc + WORKDIR /usr/src/app +RUN python -m venv /usr/src/app/venv +ENV PATH="/usr/src/app/venv/bin:$PATH" + +COPY requirements.txt . +RUN pip3 install --upgrade pip +RUN pip3 install --no-cache-dir -r requirements.txt + +FROM python:3.9.18-slim +RUN groupadd -g 999 python && \ + useradd -r -u 999 -g python python +RUN mkdir /usr/src/app && chown python:python /usr/src/app +WORKDIR /usr/src/app/venv +COPY --chown=python:python --from=build /usr/src/app/venv /usr/src/app/venv +COPY --chown=python:python . . +USER 999 + ENV LINK http://www.meetup.com/cloudyuga/ ENV TEXT1 CloudYuga ENV TEXT2 Garage RSVP! ENV LOGO https://raw.githubusercontent.com/cloudyuga/rsvpapp/master/static/cloudyuga.png ENV COMPANY CloudYuga Technology Pvt. Ltd. -RUN pip3 install -r requirements.txt -CMD python rsvp.py + +ENV PATH="/usr/src/app/venv/bin:$PATH" +EXPOSE 5000 +CMD ["python", "rsvp.py"] + diff --git a/README.md b/README.md index 1d09f920..109d7b97 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,35 @@ -# rsvpapp +# RSVP App in Python RSVP app by CloudYuga +## Steps to run the application locally +- Clone this repository +``` +git clone https://github.com/cloudyuga/rsvpapp.git +``` +- Install python and pip package manager +- Install python packages mentioned in `requirements.txt` file +``` +pip install -r requirements.txt +``` +- Install mongodb for the database.One can use mongodb as a docker container also. +``` +docker container run -d -p 27017:27017 --name=mongodb mongo:3.6 +``` +- Run the python app locally +``` +python3 rsvp.py +``` +Access the application locally on port number 5000. + +## Build the Docker image of the application +- Build the Docker image from the `Dockerfile` +``` +docker build -t /rsvpapp-python:v1 . +``` +- Start the frontend and backend of the application with the help of docker compose. +``` +docker compose up -d +``` + ## Credits Thanks to [Anand Chitipothu](https://twitter.com/anandology) for helping us with the application development. diff --git a/__init__.py b/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/docker-compose.yml b/docker-compose.yml index f54decca..d0fc2edd 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ -version: '2' +version: '3' services: mongodb: - image: mongo:3.3 + image: mongo:3.6 expose: - "27017" volumes: @@ -12,7 +12,7 @@ services: - rsvpnet web: - image: teamcloudyuga/rsvpapp:mooc + image: registry.cloudyuga.guru/library/rsvpapp:v1 ports: - "5000:5000" environment: diff --git a/templates/csvdata.html b/templates/csvdata.html deleted file mode 100755 index a7c1144e..00000000 --- a/templates/csvdata.html +++ /dev/null @@ -1,18 +0,0 @@ - - -
- - -CLick - - - - -
- - - - - diff --git a/templates/profile.html b/templates/profile.html index b957f9aa..fadc0f79 100755 --- a/templates/profile.html +++ b/templates/profile.html @@ -18,11 +18,11 @@

Serving from Host: {{ hostname }}
- +
- +
@@ -34,16 +34,15 @@

RSVP Count : {{counter}}

Email - {% for item in items %} + {% for item in items %} {{ item.name }} {{ item.email }} + {% endfor %} - - + -