-
-
Save iannbing/6c350cf848b26c0d76616d1e6955d694 to your computer and use it in GitHub Desktop.
Setup local database with Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SA_PASSWORD=YourStrong!Passw0rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
sql_server: | |
image: mcr.microsoft.com/mssql/server:2022-latest | |
env_file: | |
- .env | |
environment: | |
- ACCEPT_EULA=Y | |
ports: | |
- "1433:1433" | |
container_name: mssql_server_container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
COMPOSE_FILE := database/docker-compose.yml | |
.DEFAULT_GOAL := help | |
## ----------------------------------------------------------- | |
## Spin up the SQL Server container for local development. | |
## ----------------------------------------------------------- | |
.PHONY: help | |
help: | |
@sed -ne '/@sed/!s/## //p' $(MAKEFILE_LIST) | |
.PHONY: db-up | |
db-up: ## Start the SQL Server container | |
docker-compose -f $(COMPOSE_FILE) up -d | |
.PHONY: db-stop | |
db-stop: ## Stop the SQL Server container | |
@echo "Stopping the SQL Server container..." | |
docker-compose -f $(COMPOSE_FILE) stop | |
.PHONY: db-down | |
db-down: ## Stop and remove the SQL Server container | |
@echo "Stopping and removing the SQL Server container..." | |
docker-compose -f $(COMPOSE_FILE) down | |
.PHONY: db-restart | |
db-restart: ## Restart the SQL Server container | |
@echo "Restarting the SQL Server container..." | |
docker-compose -f $(COMPOSE_FILE) restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment