Skip to content
This repository was archived by the owner on May 31, 2019. It is now read-only.

Commit 38ba05e

Browse files
committed
Add caching of most-common Nuget Packages to image save considerable time on all builds
1 parent d7bb45a commit 38ba05e

File tree

5 files changed

+197
-35
lines changed

5 files changed

+197
-35
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
FROM debian:jessie
2+
3+
ENV DNX_VERSION 1.0.0-rc1-update1
4+
ENV DNX_USER_HOME /opt/DNX_BRANCH
5+
#Currently the CLR packages don't have runtime ids to handle debian:jessie but
6+
#we are making sure that the dependencies are the right versions and are opting for
7+
#the smaller base image. So we use this variable to overwrite the default detection.
8+
ENV DNX_RUNTIME_ID ubuntu.14.04-x64
9+
10+
# In order to address an issue with running a sqlite3 database on aspnet-docker-linux
11+
# a version of sqlite3 must be installed that is greater than or equal to 3.7.15
12+
# which is not available on the default apt sources list in this image.
13+
# ref: https://github.com/aspnet/EntityFramework/issues/3089
14+
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
15+
16+
RUN apt-get -qq update && apt-get -qqy install unzip curl libicu-dev libunwind8 gettext libssl-dev libcurl3-gnutls zlib1g sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
17+
18+
RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_USER_HOME=$DNX_USER_HOME DNX_BRANCH=v$DNX_VERSION sh
19+
RUN bash -c "source $DNX_USER_HOME/dnvm/dnvm.sh \
20+
&& dnvm install $DNX_VERSION -alias default -r coreclr \
21+
&& dnvm alias default | xargs -i ln -s $DNX_USER_HOME/runtimes/{} $DNX_USER_HOME/runtimes/default"
22+
23+
# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)
24+
# Combining this with the uninstall and purge will save us the space of the build tools in the image
25+
RUN LIBUV_VERSION=1.4.2 \
26+
&& apt-get -qq update \
27+
&& apt-get -qqy install autoconf automake build-essential libtool \
28+
&& curl -sSL https://github.com/libuv/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
29+
&& cd /usr/local/src/libuv-$LIBUV_VERSION \
30+
&& sh autogen.sh && ./configure && make && make install \
31+
&& rm -rf /usr/local/src/libuv-$LIBUV_VERSION \
32+
&& ldconfig \
33+
&& apt-get -y purge autoconf automake build-essential libtool \
34+
&& apt-get -y autoremove \
35+
&& apt-get -y clean \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
ENV PATH $PATH:$DNX_USER_HOME/runtimes/default/bin
39+
40+
# PULL a list of common dependencies on ASPNET projects. By running a DNU restore command NOW,
41+
# we save the "typical user" approximately 10 minutes in downloading the most common DNX nuget
42+
# packages.
43+
WORKDIR /home
44+
RUN echo { \
45+
\"dependencies\": { \
46+
\"EntityFramework.Commands\": \"7.0.0-rc1-final\", \
47+
\"EntityFramework.MicrosoftSqlServer\": \"7.0.0-rc1-final\", \
48+
\"EntityFramework.Sqlite\": \"7.0.0-rc1-final\", \
49+
\"Microsoft.AspNet.Authentication.Cookies\": \"1.0.0-rc1-final\", \
50+
\"Microsoft.AspNet.Diagnostics\": \"1.0.0-rc1-final\", \
51+
\"Microsoft.AspNet.Diagnostics.Entity\": \"7.0.0-rc1-final\", \
52+
\"Microsoft.AspNet.Identity.EntityFramework\": \"3.0.0-rc1-final\", \
53+
\"Microsoft.AspNet.IISPlatformHandler\": \"1.0.0-rc1-final\", \
54+
\"Microsoft.AspNet.Mvc\": \"6.0.0-rc1-final\", \
55+
\"Microsoft.AspNet.Mvc.TagHelpers\": \"6.0.0-rc1-final\", \
56+
\"Microsoft.AspNet.Server.Kestrel\": \"1.0.0-rc1-final\", \
57+
\"Microsoft.AspNet.StaticFiles\": \"1.0.0-rc1-final\", \
58+
\"Microsoft.AspNet.Tooling.Razor\": \"1.0.0-rc1-final\", \
59+
\"Microsoft.Dnx.Runtime\":\"1.0.0-rc1-final\", \
60+
\"Microsoft.Extensions.CodeGenerators.Mvc\": \"1.0.0-rc1-final\", \
61+
\"Microsoft.Extensions.Configuration.FileProviderExtensions\" : \"1.0.0-rc1-final\", \
62+
\"Microsoft.Extensions.Configuration.Json\": \"1.0.0-rc1-final\", \
63+
\"Microsoft.Extensions.Configuration.UserSecrets\": \"1.0.0-rc1-final\", \
64+
\"Microsoft.Extensions.Logging\": \"1.0.0-rc1-final\", \
65+
\"Microsoft.Extensions.Logging.Console\": \"1.0.0-rc1-final\", \
66+
\"Microsoft.Extensions.Logging.Debug\" : \"1.0.0-rc1-final\" \
67+
}, \
68+
\"frameworks\": { \
69+
\"dnx451\": {}, \
70+
\"dnxcore50\": {} \
71+
} \
72+
} > project.json && dnu restore && rm project.*
73+
#"
74+
# -- extra quotation mark to help with syntax highlighting in VSCODE
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
FROM mono:4.0.1
2+
3+
ENV DNX_VERSION 1.0.0-rc1-update1
4+
ENV DNX_USER_HOME /opt/dnx
5+
#Currently the CLR packages don't have runtime ids to handle debian:jessie but
6+
#we are making sure that the dependencies are the right versions and are opting for
7+
#the smaller base image. So we use this variable to overwrite the default detection.
8+
ENV DNX_RUNTIME_ID ubuntu.14.04-x64
9+
10+
# In order to address an issue with running a sqlite3 database on aspnet-docker-linux
11+
# a version of sqlite3 must be installed that is greater than or equal to 3.7.15
12+
# which is not available on the default apt sources list in this image.
13+
# ref: https://github.com/aspnet/EntityFramework/issues/3089
14+
RUN printf "deb http://ftp.us.debian.org/debian jessie main\n" >> /etc/apt/sources.list
15+
16+
# added sqlite3 & libsqlite3-dev install for use with aspnet-generators (Entity framework)
17+
RUN apt-get -qq update && apt-get -qqy install unzip libc6-dev libicu-dev sqlite3 libsqlite3-dev && rm -rf /var/lib/apt/lists/*
18+
19+
RUN curl -sSL https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh | DNX_USER_HOME=$DNX_USER_HOME DNX_BRANCH=v$DNX_VERSION sh
20+
RUN bash -c "source $DNX_USER_HOME/dnvm/dnvm.sh \
21+
&& dnvm install $DNX_VERSION -alias default \
22+
&& dnvm alias default | xargs -i ln -s $DNX_USER_HOME/runtimes/{} $DNX_USER_HOME/runtimes/default"
23+
24+
# Install libuv for Kestrel from source code (binary is not in wheezy and one in jessie is still too old)
25+
# Combining this with the uninstall and purge will save us the space of the build tools in the image
26+
RUN LIBUV_VERSION=1.4.2 \
27+
&& apt-get -qq update \
28+
&& apt-get -qqy install autoconf automake build-essential libtool \
29+
&& curl -sSL https://github.com/libuv/libuv/archive/v${LIBUV_VERSION}.tar.gz | tar zxfv - -C /usr/local/src \
30+
&& cd /usr/local/src/libuv-$LIBUV_VERSION \
31+
&& sh autogen.sh && ./configure && make && make install \
32+
&& rm -rf /usr/local/src/libuv-$LIBUV_VERSION \
33+
&& ldconfig \
34+
&& apt-get -y purge autoconf automake build-essential libtool \
35+
&& apt-get -y autoremove \
36+
&& apt-get -y clean \
37+
&& rm -rf /var/lib/apt/lists/*
38+
39+
ENV PATH $PATH:$DNX_USER_HOME/runtimes/default/bin
40+
41+
# Prevent `dnu restore` from stalling (gh#63, gh#80)
42+
ENV MONO_THREADS_PER_CPU 50
43+
44+
# PULL a list of common dependencies on ASPNET projects. By running a DNU restore command NOW,
45+
# we save the "typical user" approximately 10 minutes in downloading the most common DNX nuget
46+
# packages.
47+
WORKDIR /home
48+
RUN echo { \
49+
\"dependencies\": { \
50+
\"EntityFramework.Commands\": \"7.0.0-rc1-final\", \
51+
\"EntityFramework.MicrosoftSqlServer\": \"7.0.0-rc1-final\", \
52+
\"EntityFramework.Sqlite\": \"7.0.0-rc1-final\", \
53+
\"Microsoft.AspNet.Authentication.Cookies\": \"1.0.0-rc1-final\", \
54+
\"Microsoft.AspNet.Diagnostics\": \"1.0.0-rc1-final\", \
55+
\"Microsoft.AspNet.Diagnostics.Entity\": \"7.0.0-rc1-final\", \
56+
\"Microsoft.AspNet.Identity.EntityFramework\": \"3.0.0-rc1-final\", \
57+
\"Microsoft.AspNet.IISPlatformHandler\": \"1.0.0-rc1-final\", \
58+
\"Microsoft.AspNet.Mvc\": \"6.0.0-rc1-final\", \
59+
\"Microsoft.AspNet.Mvc.TagHelpers\": \"6.0.0-rc1-final\", \
60+
\"Microsoft.AspNet.Server.Kestrel\": \"1.0.0-rc1-final\", \
61+
\"Microsoft.AspNet.StaticFiles\": \"1.0.0-rc1-final\", \
62+
\"Microsoft.AspNet.Tooling.Razor\": \"1.0.0-rc1-final\", \
63+
\"Microsoft.Dnx.Runtime\":\"1.0.0-rc1-final\", \
64+
\"Microsoft.Extensions.CodeGenerators.Mvc\": \"1.0.0-rc1-final\", \
65+
\"Microsoft.Extensions.Configuration.FileProviderExtensions\" : \"1.0.0-rc1-final\", \
66+
\"Microsoft.Extensions.Configuration.Json\": \"1.0.0-rc1-final\", \
67+
\"Microsoft.Extensions.Configuration.UserSecrets\": \"1.0.0-rc1-final\", \
68+
\"Microsoft.Extensions.Logging\": \"1.0.0-rc1-final\", \
69+
\"Microsoft.Extensions.Logging.Console\": \"1.0.0-rc1-final\", \
70+
\"Microsoft.Extensions.Logging.Debug\" : \"1.0.0-rc1-final\" \
71+
}, \
72+
\"frameworks\": { \
73+
\"dnx451\": {}, \
74+
\"dnxcore50\": {} \
75+
} \
76+
} > project.json && dnu restore && rm project.*
77+
#"
78+
# -- extra quotation mark to help with syntax highlighting in VSCODE
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
![](https://avatars3.githubusercontent.com/u/6476660?v=3&s=200)
2+
3+
ASP.NET 5 Preview Docker Image
4+
====================
5+
6+
This repository contains `Dockerfile` definitions for [ASP.NET 5][home] Docker images.
7+
8+
This project is part of ASP.NET 5. You can find samples, documentation, and getting started instructions for ASP.NET 5 at the [Home][home] repo.
9+
10+
[![Build Status of Docker Image on Circle CI](https://img.shields.io/circleci/project/aspnet/aspnet-docker.svg)](https://circleci.com/gh/aspnet/aspnet-docker/tree/master)
11+
[![Downloads from Docker Hub](https://img.shields.io/docker/pulls/microsoft/aspnet.svg)](https://registry.hub.docker.com/u/microsoft/aspnet)
12+
[![Stars on Docker Hub](https://img.shields.io/docker/stars/microsoft/aspnet.svg)](https://registry.hub.docker.com/u/microsoft/aspnet)
13+
14+
## Supported tags
15+
16+
#### `coreclr`-based images
17+
18+
* [`1.0.0-rc1-update1-coreclr` _(1.0.0-rc1-update1-coreclr/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-rc1-update1-coreclr/Dockerfile)
19+
* [`1.0.0-rc1-final-coreclr` _(1.0.0-rc1-final-coreclr/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-rc1-final-coreclr/Dockerfile)
20+
* [`1.0.0-beta8-coreclr` _(1.0.0-beta8-coreclr/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta8-coreclr/Dockerfile)
21+
* [`1.0.0-beta7-coreclr` _(1.0.0-beta7-coreclr/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta7-coreclr/Dockerfile)
22+
23+
#### `mono`-based images
24+
25+
* [`1.0.0-rc1-update1`, `latest` _(1.0.0-rc1-update1/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-rc1-update1/Dockerfile)
26+
* [`1.0.0-rc1-final`, _(1.0.0-rc1-final/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-rc1-final/Dockerfile)
27+
* [`1.0.0-beta8`, _(1.0.0-beta8/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta8/Dockerfile)
28+
* [`1.0.0-beta7`, _(1.0.0-beta7/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta7/Dockerfile)
29+
* [`1.0.0-beta6`, _(1.0.0-beta6/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta6/Dockerfile)
30+
* [`1.0.0-beta5`, _(1.0.0-beta5/Dockerfile)_](https://github.com/aspnet/aspnet-docker/blob/master/1.0.0-beta5/Dockerfile)
31+
32+
## How to use this image
33+
34+
Please [read this article][webdev-article] on .NET Web Development and Tools Blog to learn more about using this image.
35+
36+
This image provides the following environment variables:
37+
38+
* `DNX_USER_HOME`: path to DNX installation (e.g. /opt/dnx)
39+
* `DNX_VERSION`: version of DNX (.NET Execution Environment) installed
40+
41+
In addition to these, `PATH` is set to include the `dnx`/`dnu` executables.
42+
43+
[home]: https://github.com/aspnet/home
44+
[webdev-article]: http://blogs.msdn.com/b/webdev/archive/2015/01/14/running-asp-net-5-applications-in-linux-containers-with-docker.aspx

1.0.0-rc1-update1/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,4 @@ RUN LIBUV_VERSION=1.4.2 \
3939
ENV PATH $PATH:$DNX_USER_HOME/runtimes/default/bin
4040

4141
# Prevent `dnu restore` from stalling (gh#63, gh#80)
42-
ENV MONO_THREADS_PER_CPU 50
43-
44-
45-
# pre-run a DNU restore on common-dependencies to ensure this runs much faster for the end user.
46-
RUN curl -sSL https://raw.githubusercontent.com/alexchesser/aspnet-docker/master/1.0.0-rc1-update1/common_dependencies.json && dnu restore -p common_dependencies.json
42+
ENV MONO_THREADS_PER_CPU 50

1.0.0-rc1-update1/common_dependencies.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)