|
1 |
| -FROM Dockerfile.kotlin |
2 |
| -FROM --platform=arm64/v8 Dockerfile.kotlin |
3 |
| -FROM openjdk:21 |
| 1 | +# Stage 1: Kotlin Build |
| 2 | +FROM openjdk:21 AS kotlin-build |
| 3 | + |
| 4 | +# Install necessary tools and Gradle |
4 | 5 | RUN apt-get update && \
|
5 |
| - apt-get install -y wget unzip |
6 |
| -RUN wget https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp |
7 |
| -RUN unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip |
8 |
| -ENV PATH=/opt/gradle/gradle-7.4.2/bin:\$PATH |
| 6 | + apt-get install -y wget unzip && \ |
| 7 | + wget https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp && \ |
| 8 | + unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip |
| 9 | + |
| 10 | +# Add Gradle to PATH |
| 11 | +ENV PATH=/opt/gradle/gradle-7.4.2/bin:$PATH |
| 12 | + |
| 13 | +# Set up Kotlin app build environment |
9 | 14 | WORKDIR /app
|
10 | 15 | COPY . /app
|
| 16 | + |
| 17 | +# Build Kotlin app |
11 | 18 | RUN ./gradlew build
|
12 | 19 |
|
13 |
| -FROM Dockerfile.swift |
14 |
| -FROM --platform=arm64/v8 swift:6.0 |
| 20 | +# Stage 2: Swift Build |
| 21 | +FROM swift:6.0 AS swift-build |
| 22 | + |
| 23 | +# Install necessary tools and Gradle |
15 | 24 | RUN apt-get update && \
|
16 |
| - apt-get install -y wget unzip |
17 |
| -RUN wget https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp |
18 |
| -RUN unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip |
19 |
| -ENV PATH=/opt/gradle/gradle-7.4.2/bin:\$PATH |
| 25 | + apt-get install -y wget unzip && \ |
| 26 | + wget https://services.gradle.org/distributions/gradle-7.4.2-bin.zip -P /tmp && \ |
| 27 | + unzip -d /opt/gradle /tmp/gradle-7.4.2-bin.zip |
| 28 | + |
| 29 | +# Add Gradle to PATH |
| 30 | +ENV PATH=/opt/gradle/gradle-7.4.2/bin:$PATH |
| 31 | + |
| 32 | +# Set up Swift app build environment |
20 | 33 | WORKDIR /app
|
21 | 34 | COPY . /app
|
| 35 | + |
| 36 | +# Build Swift app |
22 | 37 | RUN ./gradlew build
|
| 38 | + |
| 39 | +# Final Stage: Combine Artifacts |
| 40 | +FROM ubuntu:22.04 AS final |
| 41 | + |
| 42 | +# Copy Kotlin build artifacts |
| 43 | +COPY --from=kotlin-build /app /final/kotlin |
| 44 | + |
| 45 | +# Copy Swift build artifacts |
| 46 | +COPY --from=swift-build /app /final/swift |
| 47 | + |
| 48 | +# Set the working directory and default command |
| 49 | +WORKDIR /final |
| 50 | +CMD ["bash"] |
0 commit comments