Skip to content

Commit

Permalink
Adding docker build and push commands (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcieltorres committed Nov 26, 2023
1 parent 3898815 commit f482ed8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ COPY . .

FROM dependencies AS production
COPY src src
COPY settings.toml src
COPY settings.conf src
COPY logging.conf src
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
APP_NAME="python-boilerplate-project"
IMAGE_NAME="python-boilerplate-project"
VERSION="latest"

################################
# COMMANDS TO RUN LOCALLY
Expand All @@ -19,7 +21,6 @@ local/lint/fix:
local/run:
poetry run python src/main.py


############################################
# COMMANDS TO RUN USING DOCKER (RECOMMENDED)
############################################
Expand All @@ -45,9 +46,19 @@ docker/lint/fix:
docker/run:
docker-compose run ${APP_NAME} poetry run python src/main.py

####################################
# DOCKER IMAGE COMMANDS
####################################

docker/image/build:
docker build . --target production -t ${IMAGE_NAME}:${VERSION}

docker/image/push:
docker push ${IMAGE_NAME}:${VERSION}

##################
# HEPFUL COMMANDS
##################

generate-default-env-file:
@if [ ! -f .env ]; then cp env.template .env; fi;
@if [ ! -f .env ]; then cp env.template .env; fi;
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ tests | `make docker/tests` | `make local/tests` | to run the tests with coverag
lint | `make docker/lint` | `make local/lint` | to run static code analysis using ruff
lint/fix | `make docker/lint/fix` | `make local/lint/fix` | to fix files using ruff
run | `make docker/run` | `make local/run` | to run the project
build image | `make docker/image/build` | - | to build the docker image
push image | `make docker/image/push` | - | to push the docker image

**Helpful commands**

Expand Down

0 comments on commit f482ed8

Please sign in to comment.