Skip to content

Commit 12d1d03

Browse files
committed
Update containers configuration
Add Release build script and docker file. Update net core containers to lates version of net core.
1 parent 89a72d4 commit 12d1d03

4 files changed

Lines changed: 65 additions & 12 deletions

File tree

.travis.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,4 @@ before_install:
1010
- export PATH=$PATH:$HOME/.local/bin
1111

1212
script:
13-
# - if [ "$TRAVIS_TAG" != "" ]; then
14-
# docker run -it --rm -v $TRAVIS_BUILD_DIR:/sources microsoft/dotnet:1.1.0-sdk-msbuild bash /sources/scripts/PublishDebug.sh;
15-
# docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
16-
# export REPO=reloni/todo-serivce;
17-
# export TAG=Debug-"$TRAVIS_TAG";
18-
# docker build -f Dockerfile.debug -t $REPO:$TAG .;
19-
# docker tag $REPO:$TAG $REPO:latest;
20-
# docker push $REPO;
21-
# fi
22-
./Scripts/BuildImage.sh
13+
./Scripts/BuildImage_Release.sh

Dockerfile.release

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM microsoft/dotnet:1.1.2-runtime
2+
3+
# Install the AWS CLI
4+
RUN apt-get update && \
5+
apt-get -y install python curl unzip && cd /tmp && \
6+
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" \
7+
-o "awscli-bundle.zip" && \
8+
unzip awscli-bundle.zip && \
9+
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws && \
10+
rm awscli-bundle.zip && rm -rf awscli-bundle
11+
12+
# Copy our code to the "/app" folder in our container
13+
WORKDIR /app
14+
COPY ./published/release .
15+
16+
# Expose port 5000 for the Web API traffic
17+
ENV ASPNETCORE_URLS http://+:5000
18+
EXPOSE 5000
19+
20+
ENV ASPNETCORE_ENVIRONMENT Production
21+
ENV CONNECTIONSTRINGNAME ConnectionString_Postgres
22+
23+
COPY ./Scripts/secrets-entrypoint.sh /secrets-entrypoint.sh
24+
ENTRYPOINT ["/secrets-entrypoint.sh"]
25+
26+
# Run the dotnet application against a DLL from within the container
27+
#ENTRYPOINT ["dotnet", "SimpleToDoService.dll"]
28+
CMD [dotnet, "SimpleToDoService.dll"]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ set -e
33

44
if [ "${TRAVIS_TAG}" != "" ]; then
55

6-
docker run -it -d --name builder microsoft/dotnet:1.1.0-sdk-msbuild tail -f /dev/null
6+
docker run -it -d --name builder microsoft/dotnet:1.1.2-sdk tail -f /dev/null
77
docker cp src/SimpleToDoService builder:app
8-
docker exec builder bash -c 'cd /app; dotnet restore; dotnet publish -o "../published/debug"'
8+
docker exec builder bash -c 'cd /app; dotnet restore; dotnet publish --configuration release -o "../published/release"'
99
docker cp builder:published published
1010

1111
#push to AWS

Scripts/BuildImage_Release.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ "${TRAVIS_TAG}" != "" ]; then
5+
6+
docker run -it -d --name builder microsoft/dotnet:1.1.2-sdk tail -f /dev/null
7+
docker cp src/SimpleToDoService builder:app
8+
docker exec builder bash -c 'cd /app; dotnet restore; dotnet publish --configuration release -o "../published/release"'
9+
docker cp builder:published published
10+
11+
#push to AWS
12+
aws ecr get-login --region eu-central-1 > login
13+
eval "$(cat login)"
14+
export REPO=${DOCKER_AWS_REPONAME}
15+
export TAG=${TRAVIS_TAG}-release
16+
docker build -f Dockerfile.release -t $REPO:$TAG .
17+
docker tag $REPO:$TAG $REPO:latest
18+
docker push $REPO > PushLog.log
19+
echo "AWS push log ===="
20+
cat PushLog.log
21+
echo "======"
22+
23+
#push to docker-hub
24+
docker login -u ${DOCKER_USER} -p ${DOCKER_PASS}
25+
export REPO=reloni/todo-service
26+
docker build -f Dockerfile.release -t $REPO:$TAG .
27+
docker tag $REPO:$TAG $REPO:latest
28+
docker push $REPO > PushLog.log
29+
echo "Docker hub push log ===="
30+
cat PushLog.log
31+
echo "======"
32+
fi
33+
34+
exit 0;

0 commit comments

Comments
 (0)