dockerfiles
This commit is contained in:
@@ -2,14 +2,18 @@
|
|||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
EXPOSE 80
|
EXPOSE 8080
|
||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
COPY ["GeradoresWS/GeradoresWS.csproj", "GeradoresWS/"]
|
COPY ["GeradoresWS/GeradoresWS.csproj", "GeradoresWS/"]
|
||||||
|
COPY ["GeradoresService/GeradoresService.csproj", "GeradoresService/"]
|
||||||
|
|
||||||
RUN dotnet restore "GeradoresWS/GeradoresWS.csproj"
|
RUN dotnet restore "GeradoresWS/GeradoresWS.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
WORKDIR "/src/GeradoresWS"
|
WORKDIR "/src/GeradoresWS"
|
||||||
RUN dotnet build "GeradoresWS.csproj" -c Release -o /app/build
|
RUN dotnet build "GeradoresWS.csproj" -c Release -o /app/build
|
||||||
|
|
||||||
@@ -19,4 +23,9 @@ RUN dotnet publish "GeradoresWS.csproj" -c Release -o /app/publish /p:UseAppHost
|
|||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
|
|
||||||
|
# Set environment variables
|
||||||
|
ENV ASPNETCORE_URLS=http://+:8080
|
||||||
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
|
||||||
ENTRYPOINT ["dotnet", "GeradoresWS.dll"]
|
ENTRYPOINT ["dotnet", "GeradoresWS.dll"]
|
||||||
@@ -10,11 +10,9 @@ builder.Services.AddSwaggerGen();
|
|||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
if (app.Environment.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI();
|
app.UseSwaggerUI();
|
||||||
}
|
|
||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
|
|
||||||
|
|||||||
24
docker-compose.yml
Normal file
24
docker-compose.yml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
geradoresws:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "5000:8080"
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
geradoresfe:
|
||||||
|
build: ./geradoresfe
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
depends_on:
|
||||||
|
- geradoresws
|
||||||
|
environment:
|
||||||
|
- REACT_APP_API_URL=http://localhost:5000/
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
|
||||||
|
networks:
|
||||||
|
app-network:
|
||||||
|
driver: bridge
|
||||||
@@ -1,13 +1,8 @@
|
|||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
|
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
ENV REACT_APP_API_URL=http://localhost:5015/
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["npm", "start"]
|
CMD ["npm", "start"]
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import axios, { AxiosResponse } from 'axios';
|
import axios, { AxiosResponse } from 'axios';
|
||||||
|
|
||||||
const API_URL = 'http://localhost:32769/';
|
const API_URL = process.env.REACT_APP_API_URL;
|
||||||
|
|
||||||
class GeradorService {
|
class GeradorService {
|
||||||
static async GenerateNIF(type: string | null): Promise<any[]> {
|
static async GenerateNIF(type: string | null): Promise<any[]> {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export default function GeradorNIF() {
|
|||||||
<Button size="small" onClick={fetchNif}>Gerar</Button>
|
<Button size="small" onClick={fetchNif}>Gerar</Button>
|
||||||
</CardActions>
|
</CardActions>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
|
||||||
</Stack>
|
</Stack>
|
||||||
</Container>
|
</Container>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user