-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f992747
commit 85bdff2
Showing
6 changed files
with
99 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,7 @@ | |
target/ | ||
.bloop | ||
.metals | ||
metals.sbt | ||
project/project | ||
|
||
archive/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
FROM debian:11-slim as build-env | ||
|
||
# We don't use https://github.com/sbt/docker-sbt so that we can chose specific base image | ||
# https://hub.docker.com/_/eclipse-temurin | ||
ENV JAVA_HOME=/opt/java/openjdk | ||
COPY --from=eclipse-temurin:17 $JAVA_HOME $JAVA_HOME | ||
ENV PATH="${JAVA_HOME}/bin:${PATH}" | ||
|
||
WORKDIR /build | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
curl ca-certificates unzip git \ | ||
clang llvm \ | ||
# for building s2n + http4s native | ||
libssl-dev cmake build-essential | ||
|
||
# Install sbt | ||
ARG SBT_VERSION=1.9.6 | ||
RUN \ | ||
curl -sL "https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.zip" > /tmp/sbt.zip && \ | ||
unzip /tmp/sbt.zip -d /opt | ||
ENV PATH="/opt/sbt/bin:${PATH}" | ||
|
||
# Install s2n. | ||
# We don't use linuxbrew because | ||
# 1. linuxbrew doesn't support ARM64 yet https://docs.brew.sh/Homebrew-on-Linux#arm-unsupported | ||
# 2. sbt doesn't work on qemu (so we can't use --platform) because of https://github.com/docker/for-mac/issues/6174 | ||
# Therefore we build s2n from source https://github.com/aws/s2n-tls/blob/e4f5bf6e779c153d9063805be81c547584398f7a/docs/BUILD.md | ||
ARG S2N_VERSION=1.3.55 | ||
RUN git clone https://github.com/aws/s2n-tls.git --branch v$S2N_VERSION | ||
RUN cd s2n-tls && \ | ||
cmake . -Bbuild \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_INSTALL_PREFIX=./s2n-tls-install && \ | ||
cmake --build build -j $(nproc) && \ | ||
CTEST_PARALLEL_LEVEL=$(nproc) ctest --test-dir build && \ | ||
cmake --install build | ||
|
||
ARG ARCHIVE | ||
ADD $ARCHIVE /build | ||
RUN S2N_LIBRARY_PATH=/build/s2n-tls/s2n-tls-install/lib sbt nativeLink | ||
|
||
FROM debian:11-slim | ||
WORKDIR /app | ||
COPY --from=build-env /build/target/scala-3.3.1/scala-native-ember-example-out ./app | ||
# RUN ldd /app/app | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends \ | ||
libssl-dev && \ | ||
apt-get clean && rm -rf /var/lib/apt/lists/* | ||
EXPOSE 8080 | ||
ENV S2N_DONT_MLOCK=1 | ||
CMD ["./app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
mkdir -p archive | ||
|
||
untracked=$(git ls-files -o --exclude-standard) | ||
if [[ -n "$untracked" ]]; then | ||
# there are untracked files | ||
rev=$(git stash create | cut -c1-6) | ||
else | ||
rev=$(git rev-parse HEAD | cut -c1-6) | ||
fi | ||
echo "Creating git archive for current changes of ${rev}" | ||
git archive -o archive/$rev.tar $rev | ||
find archive -type f -not -name "$rev.tar" -delete | ||
|
||
docker build . -t ember-app --build-arg ARCHIVE=archive/$rev.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.7") | ||
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters