Skip to content

Commit 28b3d27

Browse files
committed
Set-up multi-stage build with automated test
1 parent 9ffde7b commit 28b3d27

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Dockerfile

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
### BUILD
2-
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.201 AS build
2+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.201 AS build-env
33
WORKDIR /source
44

55
# Prerequisites
@@ -42,8 +42,15 @@ RUN yarn --cwd src/PokerTime.Web/
4242
#COPY build.* .
4343
#RUN ./build.sh --target=restore-node-packages
4444

45-
# ... run tests - TODO: check if we can use multistage with docker repository build [https://github.com/dotnet/dotnet-docker/blob/master/samples/complexapp/Dockerfile]
46-
# ./build.sh --target=Test
45+
### TEST
46+
FROM build-env AS test
47+
48+
# ... run tests
49+
COPY . .
50+
RUN ./build.sh --target=test
51+
52+
### PUBLISHING
53+
FROM build-env AS publish
4754

4855
# ... run publish
4956
COPY . .
@@ -58,7 +65,7 @@ COPY utils/install-app-prereqs.sh utils/
5865
RUN bash utils/install-app-prereqs.sh
5966

6067
# ... Copy published app
61-
COPY --from=build /source/publish/ubuntu.18.04-x64/ .
68+
COPY --from=publish /source/publish/ubuntu.18.04-x64/ .
6269

6370
ENV ASPNETCORE_ENVIRONMENT Production
6471

docker-compose.test.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: '3.7'
2+
3+
services:
4+
sut:
5+
build:
6+
context: .
7+
target: test
8+
command: echo 1 # This is fake, the real build is in the docker file

0 commit comments

Comments
 (0)