Skip to content

Commit f26bf94

Browse files
author
Sune Bøegh
committed
Testing
1 parent 804f80d commit f26bf94

File tree

6 files changed

+133
-1
lines changed

6 files changed

+133
-1
lines changed

.github/workflows/build-action.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
tags:
8+
- "v*.*.*"
9+
pull_request:
10+
branches:
11+
- "main"
12+
13+
jobs:
14+
docker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
- name: "Test"
20+
run: echo "hello world"
21+
# - name: Docker meta
22+
# id: meta
23+
# uses: docker/metadata-action@v4
24+
# with:
25+
# images: |
26+
# ${{ vars.DOCKER_REGISTRY }}/${{ vars.DOCKER_IMAGE_NAME }}
27+
# tags: |
28+
# type=ref,event=branch
29+
# type=ref,event=pr
30+
# type=semver,pattern={{version}}
31+
# - name: Set up QEMU
32+
# uses: docker/setup-qemu-action@v2
33+
# - name: Set up Docker Buildx
34+
# uses: docker/setup-buildx-action@v2
35+
# - name: Login to Docker Hub
36+
# if: github.event_name != 'pull_request'
37+
# uses: docker/login-action@v2
38+
# with:
39+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
40+
# password: ${{ secrets.DOCKERHUB_TOKEN }}
41+
# - name: Build and push
42+
# uses: docker/build-push-action@v4
43+
# with:
44+
# context: .
45+
# push: ${{ github.event_name != 'pull_request' }}
46+
# tags: ${{ steps.meta.outputs.tags }}
47+
# labels: ${{ steps.meta.outputs.labels }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
push-downstream.sh

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:N.0-alpine AS base
2+
3+
RUN addgroup --gid 1737 -S dotnet && adduser --uid 1737 -S dotnet -G dotnet \
4+
&& apk add --no-cache dumb-init
5+
6+
COPY start.sh /bin/start.sh
7+
RUN chmod +x /bin/start.sh
8+
9+
WORKDIR /app
10+
RUN chown dotnet /app
11+
12+
USER dotnet
13+
CMD ["dumb-init", "/bin/start.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 boeegh
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
# dotnet-runx
1+
# dotnet-run-N
2+
Lightweight (Alpine) based .NET Framework N runtime container with a few tweaks:
3+
4+
* Uses [dumb-init](https://github.com/Yelp/dumb-init) to ensure proper signalling
5+
* Automatically attempts to find and start proper dll
6+
* Run as `dotnet` (uid/gid: 1737) user/group
7+
8+
Note: It's assumed that the application is [framework-dependent](https://learn.microsoft.com/en-us/dotnet/core/deploying/), and so is _not_ built as a self-contained deployment.
9+
10+
## Usage
11+
```powershell
12+
# run the .net vN web app in the current directory (browse using http://localhost:8123)
13+
docker run -p 8123:80 --rm -v ${PWD}:/app boeegh/dotnet-run-N
14+
15+
# run the .net app in the current directory
16+
docker run --rm -v ${PWD}:/app boeegh/dotnet-run-N
17+
18+
# manually specify the dll to run (the default .NET image behaviour)
19+
docker run -v ${PWD}:/app boeegh/dotnet-run-N dotnet ./MyApp.dll
20+
```
21+
22+
_Please note this is an experimental image that may... explode at any time. Use with caution. Or not at all._

start.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
# web: will run as website, if web.config is present use info from that
4+
appDll=$(grep -so -E '([^\"]*)\.dll' web.config)
5+
if [ ! $appDll ]
6+
then
7+
# app: find any executable, assume main dll has same name
8+
app=$(find . -type f -perm -u+x)
9+
if [ $app ]
10+
then
11+
appDll="$app.dll"
12+
fi
13+
fi
14+
15+
# todo: support for enforcing ownership of non-root user?
16+
17+
# no dll found?
18+
if [ ! $appDll ] || [ ! -f $appDll ]
19+
then
20+
notFound=$([ $appDll ] && echo "Identified main dll as $appDll, however it was not found.")
21+
echo -e "Unable to autostart application dll (alpine will not execute binary). $notFound\n"
22+
echo "Listing files present in $PWD:"
23+
ls .
24+
echo -e "\nYou can start the application manully using: dotnet [ dll-name ]"
25+
return
26+
fi
27+
28+
# start dll
29+
dotnet $appDll

0 commit comments

Comments
 (0)