Skip to content

Commit

Permalink
Set-up multi-stage build with automated test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebazzz committed Mar 30, 2020
1 parent 9ffde7b commit 28b3d27
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### BUILD
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.201 AS build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1.201 AS build-env
WORKDIR /source

# Prerequisites
Expand Down Expand Up @@ -42,8 +42,15 @@ RUN yarn --cwd src/PokerTime.Web/
#COPY build.* .
#RUN ./build.sh --target=restore-node-packages

# ... run tests - TODO: check if we can use multistage with docker repository build [https://github.com/dotnet/dotnet-docker/blob/master/samples/complexapp/Dockerfile]
# ./build.sh --target=Test
### TEST
FROM build-env AS test

# ... run tests
COPY . .
RUN ./build.sh --target=test

### PUBLISHING
FROM build-env AS publish

# ... run publish
COPY . .
Expand All @@ -58,7 +65,7 @@ COPY utils/install-app-prereqs.sh utils/
RUN bash utils/install-app-prereqs.sh

# ... Copy published app
COPY --from=build /source/publish/ubuntu.18.04-x64/ .
COPY --from=publish /source/publish/ubuntu.18.04-x64/ .

ENV ASPNETCORE_ENVIRONMENT Production

Expand Down
8 changes: 8 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: '3.7'

services:
sut:
build:
context: .
target: test
command: echo 1 # This is fake, the real build is in the docker file

0 comments on commit 28b3d27

Please sign in to comment.