Skip to content

Commit 9dcd318

Browse files
irinascurtujohnsimons
authored andcommitted
started docker for components
1 parent b6f132a commit 9dcd318

File tree

7 files changed

+125
-18
lines changed

7 files changed

+125
-18
lines changed

src/Billing/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
ARG BUILD_CONFIGURATION=Release
3+
ARG TARGETARCH
4+
WORKDIR /src
5+
6+
COPY . .
7+
RUN dotnet publish src/Billing -c $BUILD_CONFIGURATION -o /app/publish --arch $TARGETARCH /p:UseAppHost=false
8+
9+
10+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
11+
USER $APP_UID
12+
WORKDIR /app
13+
14+
COPY --from=build /app/publish .
15+
ENTRYPOINT ["dotnet", "Billing.dll"]

src/ClientUI/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
ARG BUILD_CONFIGURATION=Release
3+
ARG TARGETARCH
4+
WORKDIR /src
5+
6+
COPY . .
7+
RUN dotnet publish src/ClientUI -c $BUILD_CONFIGURATION -o /app/publish --arch $TARGETARCH /p:UseAppHost=false
8+
9+
10+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
11+
USER $APP_UID
12+
WORKDIR /app
13+
14+
COPY --from=build /app/publish .
15+
ENTRYPOINT ["dotnet", "ClientUI.dll"]

src/Sales/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
ARG BUILD_CONFIGURATION=Release
3+
ARG TARGETARCH
4+
WORKDIR /src
5+
6+
COPY . .
7+
RUN dotnet publish src/Sales -c $BUILD_CONFIGURATION -o /app/publish --arch $TARGETARCH /p:UseAppHost=false
8+
9+
10+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
11+
USER $APP_UID
12+
WORKDIR /app
13+
14+
COPY --from=build /app/publish .
15+
ENTRYPOINT ["dotnet", "Sales.dll"]

src/Shipping/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
2+
ARG BUILD_CONFIGURATION=Release
3+
ARG TARGETARCH
4+
WORKDIR /src
5+
6+
COPY . .
7+
RUN dotnet publish src/Sales -c $BUILD_CONFIGURATION -o /app/publish --arch $TARGETARCH /p:UseAppHost=false
8+
9+
10+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
11+
USER $APP_UID
12+
WORKDIR /app
13+
14+
COPY --from=build /app/publish .
15+
ENTRYPOINT ["dotnet", "Shipping.dll"]

src/docker-compose-base.yml

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,52 @@ services:
4343
ENABLE_REVERSE_PROXY: false
4444
SHOW_PENDING_RETRY: false
4545
vue-app:
46+
container_name: ui-app
4647
build:
47-
context: ./frontend # Point to the frontend folder
48-
dockerfile: Dockerfile # Use the Dockerfile in the frontend folder
49-
container_name: vue-app-container
48+
context: ./frontend # Path to the folder containing Dockerfile
49+
dockerfile: Dockerfile
5050
ports:
51-
- "61335:8080" # Map port 8080 in the container to 61335 on the host
51+
- "8080:80" # Map port 80 in the container to port 8080 on the host
52+
depends_on:
53+
- billing
5254
volumes:
53-
- ./frontend:/app # Mount the frontend folder into the container
54-
- /app/node_modules # Prevent overwriting node_modules
55-
command: "npm install && npm run dev" # Development mode command
55+
- ./frontend:/app # Optional for hot reloading
56+
restart: always
57+
billing:
58+
build:
59+
context: ./
60+
dockerfile: ./src/Billing/Dockerfile
61+
container_name: billing
62+
ports:
63+
- "5002:5002"
64+
environment:
65+
- ASPNETCORE_URLS=http://+:5002
66+
shipping:
67+
build:
68+
context: ./
69+
dockerfile: ./src/Shipping/Dockerfile
70+
container_name: shipping
71+
ports:
72+
- "5003:5003"
73+
environment:
74+
- ASPNETCORE_URLS=http://+:5003
75+
sales:
76+
build:
77+
context: ./
78+
dockerfile: ./src/Sales/Dockerfile
79+
container_name: sales
80+
ports:
81+
- "5001:5001"
82+
environment:
83+
- ASPNETCORE_URLS=http://+:5001
84+
clientui:
85+
build:
86+
context: ./
87+
dockerfile: ./src/ClientUI/Dockerfile
88+
container_name: clientui
89+
ports:
90+
- "5000:5000"
91+
environment:
92+
- ASPNETCORE_URLS=http://+:5000
5693
volumes:
5794
sc-data:

src/frontend/.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
npm-debug.log

src/frontend/Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1-
FROM node:lts-alpine
1+
# Use an official Node.js runtime as the base image
2+
FROM node:18 AS build-stage
23

3-
# install simple http server for serving static content
4-
RUN npm install -g http-server
5-
6-
# make the 'app' folder the current working directory
4+
# Set the working directory
75
WORKDIR /app
86

9-
# copy both 'package.json' and 'package-lock.json' (if available)
7+
# Copy package.json and package-lock.json
108
COPY package*.json ./
119

12-
# install project dependencies
10+
# Install dependencies
1311
RUN npm install
1412

15-
# copy project files and folders to the current working directory (i.e. 'app' folder)
13+
# Copy the rest of the application code
1614
COPY . .
1715

18-
# build app for production with minification
16+
# Build the application
1917
RUN npm run build
2018

21-
EXPOSE 8080
22-
CMD [ "http-server", "dist" ]
19+
# Use an official Nginx image to serve the content
20+
FROM nginx:alpine AS production-stage
21+
22+
# Copy the build output to Nginx's HTML directory
23+
COPY --from=build-stage /app/dist /usr/share/nginx/html
24+
25+
# Expose port 80
26+
EXPOSE 80
27+
28+
# Start Nginx
29+
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)