Skip to content

Commit

Permalink
update docker settings
Browse files Browse the repository at this point in the history
  • Loading branch information
nixhantb committed Jan 24, 2025
1 parent 7d55fcc commit 0210ec3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 45 deletions.
28 changes: 0 additions & 28 deletions .github/Deployments/Dockerfile

This file was deleted.

18 changes: 18 additions & 0 deletions Server/JobLeet.WebApi/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
COPY ["Server/JobLeet.WebApi/JobLeet.WebApi.sln", "./"]
COPY ["Server/JobLeet.WebApi/JobLeet.WebApi.csproj", "JobLeet.WebApi/"]
WORKDIR /src/JobLeet.WebApi
RUN dotnet restore "JobLeet.WebApi.csproj"
COPY ./Server/JobLeet.WebApi/. .
RUN dotnet build "JobLeet.WebApi.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "JobLeet.WebApi.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
WORKDIR /app
EXPOSE 8080
COPY --from=publish /app/publish .
ENV ASPNETCORE_URLS="http://+:8080"
CMD ["dotnet", "JobLeet.WebApi.dll"]
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using JobLeet.WebApi.JobLeet.Core.Entities.Common.V1;
using JobLeet.WebApi.JobLeet.Core.Entities.Companies.V1;
using JobLeet.WebApi.JobLeet.Core.Entities.Employers.V1;
using JobLeet.WebApi.JobLeet.Core.Entities.Identity;
using JobLeet.WebApi.JobLeet.Core.Entities.Jobs.V1;
using JobLeet.WebApi.JobLeet.Core.Entities.Seekers.V1;
using JobLeet.WebApi.JobLeet.Infrastructure.Data.Contexts.V1;
Expand All @@ -27,7 +26,6 @@ public BaseDBContext(DbContextOptions<BaseDBContext> options)
public virtual DbSet<Phone> Phones { get; set; }
public virtual DbSet<Education> Educations { get; set; }
public virtual DbSet<Address> Addresses { get; set; }

public virtual DbSet<JobEntity> Jobs { get; set; }
public virtual DbSet<Industry> IndustryTypes { get; set; }
public virtual DbSet<CompanyProfile> CompanyProfiles { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion Server/tests/UnitTests/UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\JobLeet.WebApi\JobLeet.WebApi.csproj" />
<ProjectReference Include="..\..\Server\JobLeet.WebApi\JobLeet.WebApi.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
29 changes: 15 additions & 14 deletions .github/Deployments/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
version: '3.8'

services:
jobleet-database:
image: postgres:13
container_name: postgresql_server
ports:
- "5432:5432"
restart: always
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: leetadmin
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
env_file:
- Server/JobLeet.WebApi/.env
volumes:
- db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "leetadmin", "-d", "${POSTGRES_DB}"]
timeout: 20s
retries: 10

test: ["CMD", "pg_isready", "-U", "${DB_USER}"]
interval: 10s
timeout: 5s
retries: 5

jobleet-api:
build: .
build:
context: .
dockerfile: Server/JobLeet.WebApi/Dockerfile
depends_on:
jobleet-database:
condition: service_healthy
ports:
ports:
- "8080:8080"
restart: always
env_file:
- Server/JobLeet.WebApi/.env
environment:
- DBHOST=jobleet-database
- ASPNETCORE_ENVIRONMENT=Development

volumes:
db_data:

name: jobleet-project

0 comments on commit 0210ec3

Please sign in to comment.