Skip to content

Commit

Permalink
Reduce image size.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle authored Mar 9, 2025
1 parent 65365cc commit a345c97
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 63 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ jobs:
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: squidex-local

test-containers:
runs-on: ubuntu-latest
Expand All @@ -38,13 +36,13 @@ jobs:
- name: Prepare - Checkout
uses: actions/[email protected]

- name: Prepare - Setup DotNet
- name: Prepare - Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Test - TestContainers
run: dotnet test backend/Squidex.sln --filter Category==TestContainers
run: dotnet test backend/Squidex.sln --filter Category=TestContainers

test-mongo:
runs-on: ubuntu-latest
Expand All @@ -56,7 +54,7 @@ jobs:
- name: Prepare - Setup Docker Buildx
uses: docker/[email protected]

- name: Prepare - Setup DotNet
- name: Prepare - Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
Expand All @@ -74,7 +72,7 @@ jobs:
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to:
tags: squidex-local

- name: Start Compose
Expand Down Expand Up @@ -157,7 +155,7 @@ jobs:
- name: Prepare - Setup Docker Buildx
uses: docker/[email protected]

- name: Prepare - Setup DotNet
- name: Prepare - Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
Expand All @@ -175,7 +173,7 @@ jobs:
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to:
tags: squidex-local

- name: Start Compose
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ jobs:
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: squidex-local

test-containers:
runs-on: ubuntu-latest
Expand All @@ -33,13 +31,13 @@ jobs:
- name: Prepare - Checkout
uses: actions/[email protected]

- name: Prepare - Setup DotNet
- name: Prepare - Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Test - TestContainers
run: dotnet test backend/Squidex.sln --filter Category==TestContainers
run: dotnet test backend/Squidex.sln --filter Category=TestContainers

test-mongo:
runs-on: ubuntu-latest
Expand All @@ -51,7 +49,7 @@ jobs:
- name: Prepare - Setup Docker Buildx
uses: docker/[email protected]

- name: Prepare - Setup DotNet
- name: Prepare - Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
Expand All @@ -69,7 +67,7 @@ jobs:
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to:
tags: squidex-local

- name: Start Compose
Expand Down Expand Up @@ -152,7 +150,7 @@ jobs:
- name: Prepare - Setup Docker Buildx
uses: docker/[email protected]

- name: Prepare - Setup DotNet
- name: Prepare - Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
Expand All @@ -170,7 +168,7 @@ jobs:
with:
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
cache-to:
tags: squidex-local

- name: Start Compose
Expand Down Expand Up @@ -253,8 +251,8 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
tags: squidex/squidex:${{ env.GITHUB_REF_SLUG }},squidex/squidex:${{ steps.version.outputs._0 }}${{env.STABLE_VERSION == 'true' && ',squidex/squidex:latest'}}
push: true
tags: squidex/squidex:${{ env.GITHUB_REF_SLUG }},squidex/squidex:${{ steps.version.outputs._0 }}${{env.STABLE_VERSION == 'true' && ',squidex/squidex:latest'}}

- name: Release - Make directories
run: sudo mkdir /build /release
Expand Down Expand Up @@ -284,6 +282,7 @@ jobs:
artifacts: "/release/binaries.zip"
body: ${{ steps.changelog_reader.outputs.changes }}
name: ${{ env.GITHUB_REF_SLUG }}
removeArtifacts: false
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ RUN apt-get update \
&& apt-get install -y ffmpeg

ARG SQUIDEX__BUILD__VERSION=7.0.0
ARG SQUIDEX__BUILD__ARGS=

WORKDIR /src

# Copy nuget project files.
COPY backend/Directory.Build.props ./
COPY backend/*.sln ./

# Copy the main source project files
Expand All @@ -32,16 +34,14 @@ RUN dotnet restore
COPY backend .

# Test Backend
RUN dotnet test --no-restore --filter "Category!=Dependencies & Category!=TestContainer"
RUN dotnet test --filter "Category!=Dependencies & Category!=TestContainer" --configuration Release

# Publish
RUN dotnet publish --no-restore src/Squidex/Squidex.csproj --output /build/ --configuration Release -p:version=$SQUIDEX__BUILD__VERSION
RUN dotnet publish src/Squidex/Squidex.csproj --output /build/ --configuration Release -p:version=$SQUIDEX__BUILD__VERSION

# Install tools
RUN dotnet tool install --tool-path /tools dotnet-counters \
&& dotnet tool install --tool-path /tools dotnet-dump \
&& dotnet tool install --tool-path /tools dotnet-gcdump \
&& dotnet tool install --tool-path /tools dotnet-trace
RUN dotnet tool install --tool-path /tools dotnet-dump \
&& dotnet tool install --tool-path /tools dotnet-gcdump


#
Expand All @@ -67,7 +67,6 @@ RUN npm run test:coverage \

RUN cp -a build /build/


#
# Stage 3, Build runtime
#
Expand All @@ -77,7 +76,9 @@ ARG SQUIDEX__RUNTIME__VERSION=7.0.0

# Curl for debugging and libc-dev for protobuf
RUN apt-get update \
&& apt-get install -y curl libc-dev ffmpeg
&& apt-get install -y --no-install-recommends curl libc-dev

COPY --from=mwader/static-ffmpeg:7.1.1 /ffprobe /usr/local/bin/

# Default tool directory
WORKDIR /tools
Expand All @@ -95,10 +96,8 @@ COPY --from=frontend /build/browser wwwroot/build/
EXPOSE 80
EXPOSE 443

ENV DIAGNOSTICS__COUNTERSTOOL=/tools/dotnet-counters
ENV DIAGNOSTICS__DUMPTOOL=/tools/dotnet-dump
ENV DIAGNOSTICS__GCDUMPTOOL=/tools/dotnet-gcdump
ENV DIAGNOSTICS__TRACETOOL=/tools/dotnet-trace
ENV ASPNETCORE_HTTP_PORTS=80

ENTRYPOINT ["dotnet", "Squidex.dll"]
Expand Down
13 changes: 13 additions & 0 deletions backend/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);INCLUDE_MAGICK;INCLUDE_KAFKA</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(DefineConstants.Contains(INCLUDE_MAGICK))'">
<IncludeMagick>true</IncludeMagick>
</PropertyGroup>

<PropertyGroup Condition="'$(DefineConstants.Contains(INCLUDE_KAFKA))'">
<IncludeKafka>true</IncludeKafka>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

#if INCLUDE_KAFKA
using System.ComponentModel.DataAnnotations;
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules;
Expand Down Expand Up @@ -55,3 +56,4 @@ public sealed record KafkaAction : RuleAction
[Editor(RuleFieldEditor.TextArea)]
public string? Schema { get; set; }
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

#if INCLUDE_KAFKA
using Squidex.Domain.Apps.Core.HandleRules;
using Squidex.Domain.Apps.Core.Rules.EnrichedEvents;

Expand Down Expand Up @@ -113,3 +114,4 @@ public sealed class KafkaJob

public int PartitionCount { get; set; }
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

#if INCLUDE_KAFKA
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
Expand All @@ -27,3 +28,4 @@ public void ConfigureServices(IServiceCollection services, IConfiguration config
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

#if INCLUDE_KAFKA
using System.Text;
using Avro;
using Avro.Generic;
Expand Down Expand Up @@ -278,3 +279,4 @@ private static bool IsTypeOrUnionWith(Schema? schema, Schema.Type expected)
return schema?.Tag == expected || (schema is UnionSchema union && union.Schemas.Any(x => x.Tag == expected));
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// All rights reserved. Licensed under the MIT license.
// ==========================================================================

#if INCLUDE_KAFKA
using Confluent.Kafka;
using Confluent.SchemaRegistry;
using Confluent.SchemaRegistry.Serdes;
Expand All @@ -27,3 +28,4 @@ public bool IsSchemaRegistryConfigured()
return !string.IsNullOrWhiteSpace(SchemaRegistry?.Url);
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<PackageReference Include="Algolia.Search" Version="6.17.0" />
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageReference Include="Azure.Search.Documents" Version="11.6.0" />
<PackageReference Include="Confluent.SchemaRegistry.Serdes.Avro" Version="2.6.0" />
<PackageReference Include="CoreTweet" Version="1.0.0.483" />
<PackageReference Include="Elasticsearch.Net" Version="7.17.5" />
<PackageReference Include="Google.Cloud.Diagnostics.Common" Version="5.2.0" />
Expand Down Expand Up @@ -41,6 +40,9 @@
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
</ItemGroup>
<ItemGroup Condition="'$(IncludeKafka)' == 'true'">
<PackageReference Include="Confluent.SchemaRegistry.Serdes.Avro" Version="2.6.0" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json" Link="stylecop.json" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Json.Microsoft" Version="8.0.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.NetTopologySuite" Version="8.0.2" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI.EntityFramework" Version="6.35.0" />
<PackageReference Include="Squidex.Assets.EntityFramework" Version="6.35.0" />
<PackageReference Include="Squidex.Assets.TusAdapter" Version="6.35.0" />
<PackageReference Include="Squidex.EFCore.BulkExtensions" Version="8.1.6" />
<PackageReference Include="Squidex.Events.EntityFramework" Version="6.35.0" />
<PackageReference Include="Squidex.Hosting" Version="6.35.0" />
<PackageReference Include="Squidex.Messaging.EntityFramework" Version="6.35.0" />
<PackageReference Include="Squidex.AI.EntityFramework" Version="6.36.0" />
<PackageReference Include="Squidex.Assets.EntityFramework" Version="6.36.0" />
<PackageReference Include="Squidex.Assets.TusAdapter" Version="6.36.0" />
<PackageReference Include="Squidex.EFCore.BulkExtensions.Core" Version="8.1.6" />
<PackageReference Include="Squidex.EFCore.BulkExtensions.MySql" Version="8.1.6" />
<PackageReference Include="Squidex.EFCore.BulkExtensions.PostgreSQL" Version="8.1.6" />
<PackageReference Include="Squidex.EFCore.BulkExtensions.SqlServer" Version="8.1.6" />
<PackageReference Include="Squidex.Events.EntityFramework" Version="6.36.0" />
<PackageReference Include="Squidex.Hosting" Version="6.36.0" />
<PackageReference Include="Squidex.Messaging.EntityFramework" Version="6.36.0" />
<PackageReference Include="Squidex.OpenIdDict.EntityFramework" Version="5.8.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
Expand Down
10 changes: 5 additions & 5 deletions backend/src/Squidex.Data.MongoDb/Squidex.Data.MongoDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<PackageReference Include="MongoDB.Driver.Core.Extensions.DiagnosticSources" Version="1.5.0" />
<PackageReference Include="MongoDB.Driver.GridFS" Version="2.30.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI.Mongo" Version="6.35.0" />
<PackageReference Include="Squidex.Assets.Mongo" Version="6.35.0" />
<PackageReference Include="Squidex.Events.Mongo" Version="6.35.0" />
<PackageReference Include="Squidex.Hosting" Version="6.35.0" />
<PackageReference Include="Squidex.Messaging.Mongo" Version="6.35.0" />
<PackageReference Include="Squidex.AI.Mongo" Version="6.36.0" />
<PackageReference Include="Squidex.Assets.Mongo" Version="6.36.0" />
<PackageReference Include="Squidex.Events.Mongo" Version="6.36.0" />
<PackageReference Include="Squidex.Hosting" Version="6.36.0" />
<PackageReference Include="Squidex.Messaging.Mongo" Version="6.36.0" />
<PackageReference Include="Squidex.OpenIddict.MongoDb" Version="5.8.4" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
<PackageReference Include="NJsonSchema" Version="11.0.2" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.AI" Version="6.35.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="6.35.0" />
<PackageReference Include="Squidex.AI" Version="6.36.0" />
<PackageReference Include="Squidex.Messaging.Subscriptions" Version="6.36.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
Expand Down
14 changes: 7 additions & 7 deletions backend/src/Squidex.Infrastructure/Squidex.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<PackageReference Include="NodaTime" Version="3.2.0" />
<PackageReference Include="OpenTelemetry.Api" Version="1.9.0" />
<PackageReference Include="RefactoringEssentials" Version="5.6.0" PrivateAssets="all" />
<PackageReference Include="Squidex.Assets" Version="6.35.0" />
<PackageReference Include="Squidex.Caching" Version="6.35.0" />
<PackageReference Include="Squidex.Events" Version="6.35.0" />
<PackageReference Include="Squidex.Hosting.Abstractions" Version="6.35.0" />
<PackageReference Include="Squidex.Log" Version="6.35.0" />
<PackageReference Include="Squidex.Messaging" Version="6.35.0" />
<PackageReference Include="Squidex.Text" Version="6.35.0" />
<PackageReference Include="Squidex.Assets" Version="6.36.0" />
<PackageReference Include="Squidex.Caching" Version="6.36.0" />
<PackageReference Include="Squidex.Events" Version="6.36.0" />
<PackageReference Include="Squidex.Hosting.Abstractions" Version="6.36.0" />
<PackageReference Include="Squidex.Log" Version="6.36.0" />
<PackageReference Include="Squidex.Messaging" Version="6.36.0" />
<PackageReference Include="Squidex.Text" Version="6.36.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
Expand Down
Loading

0 comments on commit a345c97

Please sign in to comment.