Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Docker images generation, removed dependency from JNet image #405

Merged
merged 2 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,22 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Build KNet Docker Image
run: docker build -t mases.knet -f ./src/container/DockerfileKNet.linux .
run: docker build -t knet -f ./src/container/DockerfileKNet.linux .

- name: Save Docker Image
run: docker image save -o mases.knet.linux.tar mases.knet
run: docker image save -o knet.linux.tar knet

- name: Compress KNet Docker Image
run: gzip mases.knet.linux.tar
run: gzip knet.linux.tar

- name: Build KNetConnect Docker Image
run: docker build -t mases.knetconnect -f ./src/container/DockerfileKNetConnect.linux .
run: docker build -t knetconnect -f ./src/container/DockerfileKNetConnect.linux .

- name: Save KNetConnect Docker Image
run: docker image save -o mases.knetconnect.linux.tar mases.knetconnect
run: docker image save -o knetconnect.linux.tar knetconnect

- name: Compress KNetConnect Docker Image
run: gzip mases.knetconnect.linux.tar
run: gzip knetconnect.linux.tar

- uses: actions/upload-artifact@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ jobs:
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Build Docker Image
run: docker build -t mases.knet -f ./src/container/DockerfileKNet.linux .
run: docker build -t knet -f ./src/container/DockerfileKNet.linux .

- name: Build Docker Image
run: docker build -t mases.knet -f ./src/container/DockerfileKNetConnect.linux .
run: docker build -t knetconnect -f ./src/container/DockerfileKNetConnect.linux .

# This workflow contains a single job called "build_release"
build_pullrequest:
Expand Down
36 changes: 33 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,37 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.MASES_DOCKER_HUB_USERNAME }}
password: ${{ secrets.MASES_DOCKER_HUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
masesgroup/knet
ghcr.io/${{ github.repository_owner }}/knet

- name: Build and push
uses: docker/build-push-action@v5
with:
file: ./src/container/DockerfileKNet.linux
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository_owner }}/mases.knet:latest

tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

build_container_knetconnect:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down Expand Up @@ -111,21 +126,36 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.MASES_DOCKER_HUB_USERNAME }}
password: ${{ secrets.MASES_DOCKER_HUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
masesgroup/knetconnect
ghcr.io/${{ github.repository_owner }}/knetconnect

- name: Build and push
uses: docker/build-push-action@v5
with:
file: ./src/container/DockerfileKNetConnect.linux
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/${{ github.repository_owner }}/mases.knetconnect:latest
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

# This workflow contains a single job called "build_release"
build_release:
Expand Down
6 changes: 5 additions & 1 deletion src/container/DockerfileKNet.linux
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ RUN dotnet restore KNetDocker.sln
RUN dotnet publish ./KNetCLI/KNetCLI.csproj --framework net6.0 -c Release -o out

# Build runtime image
FROM ghcr.io/masesgroup/mases.jnet:latest
FROM mcr.microsoft.com/dotnet/runtime:6.0

# Add JRE
RUN apt update
RUN apt install -y openjdk-11-jre-headless

ADD ./jars /app/jars
ADD ./src/config /app/config
Expand Down
6 changes: 5 additions & 1 deletion src/container/DockerfileKNetConnect.linux
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ RUN dotnet restore KNetDocker.sln
RUN dotnet publish ./KNetConnect/KNetConnect.csproj --framework net6.0 -c Release -o out

# Build runtime image
FROM ghcr.io/masesgroup/mases.jnet:latest
FROM mcr.microsoft.com/dotnet/runtime:6.0

# Add JRE
RUN apt update
RUN apt install -y openjdk-11-jre-headless

ADD ./jars /app/jars
ADD ./src/config /app/config
Expand Down
Loading