Skip to content

Commit 5dec3ac

Browse files
committed
feat: add CRUD python app and postgres datadump
1 parent 9db2274 commit 5dec3ac

11 files changed

+57208
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
__pycache__

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,3 +158,6 @@ cython_debug/
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160160
#.idea/
161+
162+
163+
Instructions.md

Dockerfile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM python:3.9-buster
2+
3+
WORKDIR /app
4+
5+
COPY ./rates/requirements.txt /app
6+
7+
# Install Gunicorn and any needed packages specified in requirements.txt
8+
RUN pip install --no-cache-dir gunicorn && \
9+
pip install --no-cache-dir -r requirements.txt
10+
11+
COPY ./rates /app
12+
# Make port 8000 available to the world outside this container
13+
EXPOSE 3000
14+
15+
# Define environment variables
16+
ENV PYTHONUNBUFFERED 1
17+
18+
# Run Gunicorn with your application
19+
CMD ["gunicorn", "-b", ":3000", "wsgi"]

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#COLORS
2+
GREEN := $(shell tput -Txterm setaf 2)
3+
WHITE := $(shell tput -Txterm setaf 7)
4+
YELLOW := $(shell tput -Txterm setaf 3)
5+
RESET := $(shell tput -Txterm sgr0)
6+
7+
# Add the following 'help' target to your Makefile
8+
# And add help text after each target name starting with '\#\#'
9+
# A category can be added with @category
10+
HELP_FUN = \
11+
%Targets; \
12+
while(<>) { push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
13+
print "\n${WHITE}usage:\n"; \
14+
print " ${YELLOW}make <target> ${GREEN} Replace the <target> with one of below operations.\n\n"; \
15+
for (sort keys %help) { \
16+
print "${WHITE}$$_:${RESET}\n"; \
17+
for (@{$$help{$$_}}) { \
18+
$$sep = " " x (32 - length $$_->[0]); \
19+
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
20+
}; \
21+
print "\n"; }
22+
23+
help: ##@target Show target help options.
24+
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
25+
26+
start-app-db: FORCE ##@target Starts the app and db with sample data dump
27+
docker compose up -d ;\
28+
docker compose exec db /bin/bash ./opt/upload.sh
29+
30+
clear: FORCE ##@target Clears the "__pycache__" & ".pytest_cache". Will be required to run twice.
31+
@find . -name "__pycache__" -exec rm -rf {} \;
32+
@find . -name ".pytest_cache" -exec rm -rf {} \;
33+
34+
FORCE:

0 commit comments

Comments
 (0)