Skip to content

Commit

Permalink
feat(dockercompose): initial dockercompose created
Browse files Browse the repository at this point in the history
* feat(dockercompose): first structure of dockercompose added

* fix(dockercompse): dotenv image added

* fix(dockercompose): container port changed
  • Loading branch information
aliyaghini authored Aug 15, 2024
1 parent a37e39b commit 0e022b1
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ WORKDIR /app
COPY --from=build /app/out ./

ENV ASPNETCORE_ENVIRONMENT=Development
#ENV ConnectionStrings__DefaultConnection=Host=db;Database=YourDatabaseName;Username=yourusername;Password=yourpassword
#ENV ConnectionStrings__DefaultConnection=Host=postgres;Database=mohaymen;Username=postgres;Password=1234;
ENV ASPNETCORE_URLS=http://*:80
EXPOSE 80

Expand Down
39 changes: 39 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
services:
postgres:
image: postgres:15
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: 1234
POSTGRES_DB: mohaymen
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data

migrate:
image: mcr.microsoft.com/dotnet/sdk:8.0
depends_on:
- postgres
working_dir: /app
volumes:
- .:/app
environment:
ConnectionStrings__DefaultConnection: Host=postgres;Database=mohaymen;Username=postgres;Password=1234;
command: >
bash -c "dotnet tool install --global dotnet-ef &&
export PATH=\"$PATH:/root/.dotnet/tools\" &&
dotnet ef database update --project AnalysisData/AnalysisData/AnalysisData.csproj"
web:
image: yaghooli/dotnetdev:latest
depends_on:
migrate:
condition: service_completed_successfully
environment:
ASPNETCORE_ENVIRONMENT: Development
ConnectionStrings__DefaultConnection: Host=postgres;Database=mohaymen;Username=postgres;Password=1234;
ports:
- "8085:80"

volumes:
pgdata:

0 comments on commit 0e022b1

Please sign in to comment.