aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.dockerignore25
-rw-r--r--Dockerfile37
-rw-r--r--Earthfile43
3 files changed, 62 insertions, 43 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..6666f44
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,25 @@
+.git
+.gitignore
+.github
+.vscode
+.DS_Store
+
+# Gleam
+build
+*.beam
+*.ez
+erl_crash.dump
+
+# Nix
+flake.lock
+flake.nix
+result
+
+# SQLite
+data
+*.sqlite3
+*.db
+
+# Documentation/License
+README.md
+LICENSE
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..af799ad
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,37 @@
+# syntax=docker/dockerfile:1.7
+
+FROM ghcr.io/gleam-lang/gleam:v1.10.0-erlang-alpine AS build
+
+SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
+
+# hadolint ignore=DL3018
+RUN apk add --no-cache build-base
+
+WORKDIR /mayu
+
+COPY gleam.toml manifest.toml ./
+COPY src/ ./src/
+
+RUN gleam build
+
+WORKDIR /mayu/build
+
+RUN gleam export erlang-shipment
+
+FROM ghcr.io/gleam-lang/gleam:v1.10.0-erlang-alpine
+
+SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
+
+WORKDIR /mayu
+
+COPY --from=build /mayu/build/erlang-shipment/ ./erlang-shipment/
+COPY themes/ ./themes/
+COPY index.html ./
+COPY gleam.toml ./
+
+RUN grep '^version' gleam.toml | cut -d '"' -f 2 > .mayu-version \
+ && rm gleam.toml
+
+ENTRYPOINT ["sh", "-c", "exec env MAYU_VERSION=\"$(cat /mayu/.mayu-version)\" /mayu/erlang-shipment/entrypoint.sh \"$@\"", "--"]
+
+CMD ["run"]
diff --git a/Earthfile b/Earthfile
deleted file mode 100644
index af01298..0000000
--- a/Earthfile
+++ /dev/null
@@ -1,43 +0,0 @@
-VERSION 0.8
-
-image-all-platforms:
- BUILD --platform=linux/amd64 --platform=linux/arm64 +image
-
-image:
- ARG tag=latest
-
- FROM ghcr.io/gleam-lang/gleam:v1.10.0-erlang-alpine
-
- COPY +build/erlang-shipment/ /mayu/erlang-shipment/
- COPY themes/ /mayu/themes/
- COPY index.html /mayu/
- COPY gleam.toml /mayu/
-
- ENV MAYU_VERSION=$(grep version /mayu/gleam.toml | cut -d '"' -f 2)
-
- RUN rm /mayu/gleam.toml
-
- WORKDIR /mayu/
-
- ENTRYPOINT ["./erlang-shipment/entrypoint.sh"]
-
- CMD ["run"]
-
- SAVE IMAGE --push fuwn/mayu:${tag}
-
-build:
- FROM ghcr.io/gleam-lang/gleam:v1.10.0-erlang-alpine
-
- RUN apk add --no-cache build-base
-
- WORKDIR /mayu/
-
- COPY src/ /mayu/src/
- COPY gleam.toml /mayu/
- COPY manifest.toml /mayu/
-
- RUN gleam build \
- && cd build/ \
- && gleam export erlang-shipment
-
- SAVE ARTIFACT /mayu/build/erlang-shipment/