-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from Opvolger/feature/dockerimage
Build smtp4dev in docker image!
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.dockerignore | ||
.env | ||
.git | ||
.gitignore | ||
.vs | ||
.vscode | ||
docker-compose.yml | ||
docker-compose.*.yml | ||
*/bin | ||
*/obj | ||
*/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM microsoft/aspnetcore-build:2.0 AS build | ||
WORKDIR /app | ||
|
||
# replace shell with bash so we can source files | ||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
|
||
# nvm environment variables | ||
ENV NVM_DIR /usr/local/nvm | ||
ENV NODE_VERSION 8.11.3 | ||
|
||
# install nvm | ||
# https://github.com/creationix/nvm#install-script | ||
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash | ||
|
||
# install node and npm | ||
RUN source $NVM_DIR/nvm.sh \ | ||
&& nvm install $NODE_VERSION \ | ||
&& nvm alias default $NODE_VERSION \ | ||
&& nvm use default | ||
|
||
# add node and npm to path so the commands are available | ||
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules | ||
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH | ||
|
||
# confirm installation | ||
RUN node -v | ||
RUN npm -v | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY *.sln . | ||
COPY Rnwood.Smtp4dev/*.csproj ./Rnwood.Smtp4dev/ | ||
RUN dotnet restore Rnwood.Smtp4dev | ||
|
||
# copy everything else and build app | ||
COPY . . | ||
WORKDIR /app/Rnwood.Smtp4dev | ||
RUN npm install | ||
RUN dotnet build | ||
|
||
FROM build AS publish | ||
WORKDIR /app/Rnwood.Smtp4dev | ||
RUN dotnet publish -c Release -o out | ||
|
||
FROM microsoft/aspnetcore:2.0 AS runtime | ||
WORKDIR /app | ||
EXPOSE 80 | ||
EXPOSE 25 | ||
COPY --from=publish /app/Rnwood.Smtp4dev/out ./ | ||
ENTRYPOINT ["dotnet", "Rnwood.Smtp4dev.dll"] |