Skip to content

Commit d90a6fd

Browse files
author
Wes Grimes
committed
Use official aspnetcore images for Dockerfile
1 parent 0d465f5 commit d90a6fd

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

Dockerfile

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
FROM microsoft/dotnet:2.1-sdk as build-env
1+
FROM microsoft/aspnetcore-build:2 as build-env
22
WORKDIR /app
3-
#setup node
3+
44
ENV NODE_VERSION 8.11.1
5+
ENV NODE_DOWNLOAD_URL https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz
56

6-
RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \
7-
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
7+
RUN curl -SL "$NODE_DOWNLOAD_URL" --output nodejs.tar.gz \
8+
&& mkdir -p /usr/local/opt/nodejs8 \
9+
&& tar -xzf "nodejs.tar.gz" -C /usr/local/opt/nodejs8 --strip-components=1 \
810
&& rm nodejs.tar.gz \
9-
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
11+
&& ln -f -s /usr/local/opt/nodejs8/bin/node /usr/local/bin/node \
12+
&& ln -f -s /usr/local/opt/nodejs8/bin/node /usr/local/bin/nodejs
1013

1114
# copy csproj and restore as distinct layers
1215
COPY *.csproj ./
@@ -17,15 +20,7 @@ COPY . ./
1720
RUN dotnet publish -c Release -o out
1821

1922
# build runtime image
20-
FROM microsoft/aspnetcore:2.0
23+
FROM microsoft/aspnetcore:2
2124
WORKDIR /app
22-
#setup node, this is only needed if you use Node both at runtime and build time. Some people may only need the build part.
23-
ENV NODE_VERSION 8.11.1
24-
25-
RUN curl -SL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" --output nodejs.tar.gz \
26-
&& tar -xzf "nodejs.tar.gz" -C /usr/local --strip-components=1 \
27-
&& rm nodejs.tar.gz \
28-
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs
29-
3025
COPY --from=build-env /app/out .
31-
ENTRYPOINT ["dotnet", "dotnet-app.dll"]
26+
ENTRYPOINT ["dotnet", "dotnet-app.dll"]

0 commit comments

Comments
 (0)