Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docker build and push commands #40

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading