Skip to content

Commit 12c599a

Browse files
committed
Fix issues
1 parent 31287ca commit 12c599a

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

Dockerfile

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
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
45
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
914
WORKDIR /app
1015
COPY . /app
16+
17+
# Build Kotlin app
1118
RUN ./gradlew build
1219

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
1524
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
2033
WORKDIR /app
2134
COPY . /app
35+
36+
# Build Swift app
2237
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

Comments
 (0)