Skip to content

Commit

Permalink
feat: build and deploy basic concepts added
Browse files Browse the repository at this point in the history
  • Loading branch information
mattc41190 committed Jan 2, 2021
1 parent dc56a1a commit 800c585
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 28 deletions.
44 changes: 44 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file specifies files that are *not* uploaded to Google Cloud Platform
# using gcloud. It follows the same syntax as .gitignore, with the addition of
# "#!include" directives (which insert the entries of the given .gitignore-style
# file at that point).
#
# For more information, run:
# $ gcloud topic gcloudignore
#
.gcloudignore
# If you would like to upload your .git directory, .gitignore file or files
# from your .gitignore file, remove the corresponding line
# below:
.git
.gitignore

# Python

.venv/

*.pyc
__pycache__/
.mypy_cache

instance/

.pytest_cache/
.coverage
htmlcov/

dist/
build/
*.egg-info/

## Node

node_modules

# Ignored by the build system
/setup.cfg

# Others
*.md
Makefile
run.sh
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ EXPOSE 5000
EXPOSE 80

# Create settable enviornment variables
ENV APP_ENV="development"
ENV APP_PORT="5000"

# Set the starting program to shell
ENTRYPOINT [ "sh" ]
ENV SCRIPT="run_dev.sh"
ENV PORT="5000"

# Run the start server command
RUN echo ${APP_ENV} ${APP_PORT}
CMD [ "run.sh", "${APP_ENV} ${APP_PORT}"]
CMD sh $SCRIPT
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,18 @@ check: check_python
build_image: check
docker build -t utilities-for-me:latest .

.PHONY: run_dev_local
run_dev_local: check
export PORT=5000 && sh run_dev.sh

.PHONY: run_prod_local
run_prod_local:
export PORT=80 && sh run_prod.sh

.PHONY: run_dev_image
run_dev_image: build_image
docker run -d -p 5000:5000 utilities-for-me:latest
docker run -e "SCRIPT=run_dev.sh" -d -p 5000:5000 utilities-for-me:latest

.PHONY: run_prod_image
run_prod_image: build_image
docker run -e "APP_ENV=production" -e "APP_PORT=80" -d -p 80:80 utilities-for-me:latest
docker run -e "PORT=80" -e "SCRIPT=run_prod.sh" -d -p 80:80 utilities-for-me:latest
8 changes: 7 additions & 1 deletion READLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,20 @@ This is a collection of documentation items pertaining to the Utilities for Me a
## The List

- Flask
- [Flask Reference Docs](https://flask.palletsprojects.com/en/1.1.x/)
- Docker
- [Dockerfile Reference](https://docs.docker.com/engine/reference/builder/)
- Pytest
- [Pytest Reference Docs](https://docs.pytest.org/en/stable/contents.html)
- Black
- [Black Reference Docs](https://black.readthedocs.io/en/stable/)
- Make
- [Make Reference Docs](https://www.gnu.org/software/make/manual/make.html)
- Git
- [Git Reference Docs](https://git-scm.com/doc)
- Jinja2
- [Jinja2 Reference Docs](https://jinja.palletsprojects.com/en/2.11.x/)
- Shell
- [Pass Args](https://www.lifewire.com/pass-arguments-to-bash-script-2200571)
- Gunicorn
- [Reference Docs](https://docs.gunicorn.org/en/latest/install.html)
- [Gunicorn Reference Docs](https://docs.gunicorn.org/en/latest/install.html)
2 changes: 2 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
runtime: python38
entrypoint: gunicorn -b 0.0.0.0:8080 -w 4 utilities_for_me.web_app.wsgi:app
18 changes: 0 additions & 18 deletions run.sh

This file was deleted.

5 changes: 5 additions & 0 deletions run_dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export FLASK_APP=utilities_for_me.web_app.server
export FLASK_ENV=development
flask run \
--host=0.0.0.0 \
--port=$PORT
1 change: 1 addition & 0 deletions run_prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gunicorn -b 0.0.0.0:$PORT -w 4 utilities_for_me.web_app.wsgi:app

0 comments on commit 800c585

Please sign in to comment.