瀏覽代碼

added arguments for backend; added image names

tags/v0.1.0^0
Robin Thoni 8 年之前
父節點
當前提交
0571410088
共有 2 個檔案被更改,包括 13 行新增6 行删除
  1. 5
    4
      backend/Dockerfile
  2. 8
    2
      docker-compose.yml

+ 5
- 4
backend/Dockerfile 查看文件

@@ -4,14 +4,15 @@ RUN rm -rf /var/log/*
4 4
 
5 5
 COPY ./backend/ /tmp/backend/
6 6
 
7
-ENV WEBAPI_PROJECT WebTest
8
-ENV BUILD_CONFIG Release
7
+ARG WEBAPI_PROJECT=WebApi
8
+ARG BUILD_CONFIG=Release
9 9
 
10
-RUN cd /tmp/backend && \
10
+RUN echo "Building ${WEBAPI_PROJECT} in ${BUILD_CONFIG} configuration" && \
11
+    cd /tmp/backend && \
11 12
     dotnet restore && \
12 13
     mkdir /var/www && \
13 14
     cd /tmp/backend/${WEBAPI_PROJECT} && \
14
-    dotnet publish --output /var/www && \
15
+    dotnet publish --configuration "${BUILD_CONFIG}" --output /var/www && \
15 16
     ln -s /var/www/${WEBAPI_PROJECT}.dll /var/www/__RUN_ME.DLL &&\
16 17
     rm /tmp/backend -rf
17 18
 

+ 8
- 2
docker-compose.yml 查看文件

@@ -3,6 +3,7 @@ version: '2'
3 3
 services:
4 4
     postgresql:
5 5
         build: ./postgresql
6
+        image: project-luticate2-postgresql-image:dev
6 7
         container_name: project-luticate2-postgresql
7 8
         networks:
8 9
             project.internal.docker:
@@ -17,6 +18,7 @@ services:
17 18
 
18 19
     frontend:
19 20
         build: ./frontend
21
+        image: project-luticate2-frontend-image:dev
20 22
         container_name: project-luticate2-frontend
21 23
         networks:
22 24
             project.internal.docker:
@@ -28,7 +30,12 @@ services:
28 30
             - env
29 31
 
30 32
     backend:
31
-        build: ./backend
33
+        build:
34
+            context: ./backend
35
+            args:
36
+                - WEBAPI_PROJECT=WebApiUtils
37
+                - BUILD_CONFIG=Release
38
+        image: project-luticate2-backend-image:dev
32 39
         container_name: project-luticate2-backend
33 40
         networks:
34 41
             project.internal.docker:
@@ -37,6 +44,5 @@ services:
37 44
         env_file:
38 45
             - env
39 46
 
40
-
41 47
 networks:
42 48
     project.internal.docker:

Loading…
取消
儲存