Skip to content

Commit

Permalink
Apply recommended docker image layout (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaliumhexacyanoferrat authored Jan 21, 2025
1 parent 7ad6a8d commit d2702a5
Show file tree
Hide file tree
Showing 36 changed files with 210 additions and 476 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
cd /tmp/genhttp/webservice/
rm -rf ./webservice/bin/
rm -rf ./webservice/obj/
docker build -f Dockerfile.linux-x64 -t webservice .
docker build -t webservice .
- name: Test controller framework
run: |
mkdir -p /tmp/genhttp/controllers/
Expand All @@ -57,7 +57,7 @@ jobs:
cd /tmp/genhttp/controllers/
rm -rf ./controllers/bin/
rm -rf ./controllers/obj/
docker build -f Dockerfile.linux-x64 -t controllers .
docker build -t controllers .
- name: Test minimal framework
run: |
mkdir -p /tmp/genhttp/minimal/
Expand All @@ -67,7 +67,7 @@ jobs:
cd /tmp/genhttp/minimal/
rm -rf ./minimal/bin/
rm -rf ./minimal/obj/
docker build -f Dockerfile.linux-x64 -t minimal .
docker build -t minimal .
- name: Test static website
run: |
mkdir -p /tmp/genhttp/website/
Expand All @@ -78,7 +78,7 @@ jobs:
cd /tmp/genhttp/website/
rm -rf ./website/bin/
rm -rf ./website/obj/
docker build -f Dockerfile.linux-x64 -t website .
docker build -t website .
- name: Test websockets
run: |
mkdir -p /tmp/genhttp/websockets/
Expand All @@ -89,7 +89,7 @@ jobs:
cd /tmp/genhttp/websockets/
rm -rf ./websockets/bin/
rm -rf ./websockets/obj/
docker build -f Dockerfile.linux-x64 -t websocket .
docker build -t websocket .
- name: Test server sent events
run: |
mkdir -p /tmp/genhttp/sse/
Expand All @@ -100,4 +100,4 @@ jobs:
cd /tmp/genhttp/sse/
rm -rf ./sse/bin/
rm -rf ./sse/obj/
docker build -f Dockerfile.linux-x64 -t sse .
docker build -t sse .
19 changes: 19 additions & 0 deletions Templates/ServerSentEvents/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
ARG TARGETARCH
WORKDIR /source

COPY --link $safeprojectname$/*.csproj .
RUN dotnet restore -a "$TARGETARCH"

COPY --link $safeprojectname$/. .
RUN dotnet publish --no-restore -a "$TARGETARCH" -o /app

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md

FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
EXPOSE 8080
WORKDIR /app
COPY --link --from=build /app .
USER $APP_UID
ENTRYPOINT ["./$safeprojectname$"]
19 changes: 0 additions & 19 deletions Templates/ServerSentEvents/Dockerfile.linux-arm32

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/ServerSentEvents/Dockerfile.linux-arm64

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/ServerSentEvents/Dockerfile.linux-x64

This file was deleted.

2 changes: 1 addition & 1 deletion Templates/ServerSentEvents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ following commands in your terminal (and adjust the first line
depending on your platform).

```
docker build -f Dockerfile.linux-x64 -t $safeprojectname$ .
docker build -t $safeprojectname$ .
docker run -p 8080:8080 $safeprojectname$
```
Expand Down
19 changes: 19 additions & 0 deletions Templates/SinglePageApplication/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
ARG TARGETARCH
WORKDIR /source

COPY --link $safeprojectname$/*.csproj .
RUN dotnet restore -a "$TARGETARCH"

COPY --link $safeprojectname$/. .
RUN dotnet publish --no-restore -a "$TARGETARCH" -o /app

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md

FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
EXPOSE 8080
WORKDIR /app
COPY --link --from=build /app .
USER $APP_UID
ENTRYPOINT ["./$safeprojectname$"]
19 changes: 0 additions & 19 deletions Templates/SinglePageApplication/Dockerfile.linux-arm32

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/SinglePageApplication/Dockerfile.linux-arm64

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/SinglePageApplication/Dockerfile.linux-x64

This file was deleted.

2 changes: 1 addition & 1 deletion Templates/SinglePageApplication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ following commands in your terminal (and adjust the first line
depending on your platform).

```
docker build -f Dockerfile.linux-x64 -t $safeprojectname$ .
docker build -t $safeprojectname$ .
docker run -p 8080:8080 $safeprojectname$
```
Expand Down
19 changes: 19 additions & 0 deletions Templates/Webservice-Controllers/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
ARG TARGETARCH
WORKDIR /source

COPY --link $safeprojectname$/*.csproj .
RUN dotnet restore -a "$TARGETARCH"

COPY --link $safeprojectname$/. .
RUN dotnet publish --no-restore -a "$TARGETARCH" -o /app

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md

FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
EXPOSE 8080
WORKDIR /app
COPY --link --from=build /app .
USER $APP_UID
ENTRYPOINT ["./$safeprojectname$"]
19 changes: 0 additions & 19 deletions Templates/Webservice-Controllers/Dockerfile.linux-arm32

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/Webservice-Controllers/Dockerfile.linux-arm64

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/Webservice-Controllers/Dockerfile.linux-x64

This file was deleted.

2 changes: 1 addition & 1 deletion Templates/Webservice-Controllers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ following commands in your terminal (and adjust the first line
depending on your platform).

```
docker build -f Dockerfile.linux-x64 -t $safeprojectname$ .
docker build -t $safeprojectname$ .
docker run -p 8080:8080 $safeprojectname$
```
Expand Down
19 changes: 19 additions & 0 deletions Templates/Webservice-Minimal/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0-alpine AS build
ARG TARGETARCH
WORKDIR /source

COPY --link $safeprojectname$/*.csproj .
RUN dotnet restore -a "$TARGETARCH"

COPY --link $safeprojectname$/. .
RUN dotnet publish --no-restore -a "$TARGETARCH" -o /app

# Enable globalization and time zones:
# https://github.com/dotnet/dotnet-docker/blob/main/samples/enable-globalization.md

FROM mcr.microsoft.com/dotnet/aspnet:9.0-alpine
EXPOSE 8080
WORKDIR /app
COPY --link --from=build /app .
USER $APP_UID
ENTRYPOINT ["./$safeprojectname$"]
19 changes: 0 additions & 19 deletions Templates/Webservice-Minimal/Dockerfile.linux-arm32

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/Webservice-Minimal/Dockerfile.linux-arm64

This file was deleted.

19 changes: 0 additions & 19 deletions Templates/Webservice-Minimal/Dockerfile.linux-x64

This file was deleted.

Loading

0 comments on commit d2702a5

Please sign in to comment.