-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci!: improve development environment
BREAKING CHANGE: renamed docker compose files to compose*.yml. Simplify running up development environment. Now it requires to use simple command: docker-compose watch Introduce a watch mechanism in development environemnt to rebuild dotnet container each time the server source code is changed. Add healtcheck mechanism to ensure the functionality of the postgres before running up the rest of services.
- Loading branch information
Showing
9 changed files
with
130 additions
and
51 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# SERVER | ||
ASPNETCORE_ENVIRONMENT=Development | ||
|
||
SERVER_LISTEN_PORT=5272 | ||
|
||
# POSTGRES | ||
POSTGRES_USER=dba | ||
POSTGRES_PASSWORD=sql | ||
|
@@ -12,4 +17,4 @@ POSTGRES_CLIENT_PASSWORD=sql | |
# PGADMIN | ||
PGADMIN_LISTEN_PORT=5050 | ||
PGADMIN_DEFAULT_EMAIL=[email protected] | ||
PGADMIN_DEFAULT_PASSWORD=sql | ||
PGADMIN_DEFAULT_PASSWORD=sql |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.DS_Store | ||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build | ||
COPY . /source | ||
WORKDIR /source/ReasnAPI/ReasnAPI | ||
ARG TARGETARCH | ||
RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \ | ||
dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app | ||
|
||
FROM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS development | ||
COPY . /source | ||
WORKDIR /source/ReasnAPI/ReasnAPI | ||
CMD ["dotnet", "run", "--no-launch-profile"] | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS production | ||
WORKDIR /app | ||
COPY --from=build /app . | ||
USER $APP_UID | ||
ENTRYPOINT ["dotnet", "ReasnAPI.dll"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
services: | ||
server: | ||
build: | ||
target: development | ||
develop: | ||
watch: | ||
- action: rebuild | ||
path: ./Server/ReasnAPI/ReasnAPI | ||
|
||
postgres: | ||
expose: | ||
- 5432 | ||
volumes: | ||
- ./Database/init-dev-data.sql:/docker-entrypoint-initdb.d/03-init-dev-data.sql | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
services: | ||
server: | ||
build: | ||
context: Server | ||
dockerfile: server.Dockerfile | ||
target: production | ||
networks: | ||
- reasn-network | ||
ports: | ||
- "${SERVER_LISTEN_PORT:-5272}:8080" | ||
env_file: | ||
- .env | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|
||
postgres: | ||
image: postgres:16 | ||
restart: unless-stopped | ||
networks: | ||
- reasn-network | ||
volumes: | ||
- postgres-data:/var/lib/postgresql/data | ||
- ./Database/init-db.sql:/docker-entrypoint-initdb.d/01-init-db.sql | ||
- ./Database/init-constraints.sql:/docker-entrypoint-initdb.d/02-init-constraints.sql | ||
- ./Database/init-users.sh:/docker-entrypoint-initdb.d/99-init-users.sh | ||
env_file: | ||
- .env | ||
healthcheck: | ||
test: ["CMD", "pg_isready", "-U", "${POSTGRES_USER:-postgres}", "-d", "${POSTGRES_DB:-postgres}"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
pgadmin: | ||
image: dpage/pgadmin4:8.0 | ||
networks: | ||
- reasn-network | ||
ports: | ||
- "${PGADMIN_LISTEN_PORT:-5050}:${PGADMIN_LISTEN_PORT:-80}" | ||
volumes: | ||
- pgadmin-data:/var/lib/pgadmin | ||
env_file: | ||
- .env | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
|
||
networks: | ||
reasn-network: | ||
driver: bridge | ||
|
||
volumes: | ||
postgres-data: | ||
pgadmin-data: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.