Skip to content

Commit ea7a155

Browse files
authored
build: have Clever Cloud build the image from source (#55)
Previously `Dockerfile` was a passthrough that pulled a prebuilt image from GHCR. The point was to dodge OOM kills on Clever's smaller builders, but it had a deploy-time cost: Clever's docker layer cache would hold onto the cached `FROM ghcr.io/...:latest` layer across deploys, so config changes required an empty 'redeploy' commit AND a cache bust to actually reach prod. Move the real source build into `Dockerfile` and drop the passthrough. Each git push now does a full rebar3 release on Clever itself — slower, but every commit deploys what's in the commit. The GHCR workflow still runs (now pointed at `Dockerfile`) so the public image stays available for self-hosters; it's just no longer in the deploy path.
1 parent 0865b40 commit ea7a155

3 files changed

Lines changed: 31 additions & 53 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
5050
with:
5151
context: .
52-
file: Dockerfile.build
52+
file: Dockerfile
5353
push: true
5454
tags: ${{ steps.meta.outputs.tags }}
5555
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
1-
#
2-
# Passthrough Dockerfile for Clever Cloud.
3-
#
4-
# The real image is built in GitHub Actions (see
5-
# .github/workflows/docker-publish.yml) and published to GHCR. Clever's
6-
# builder OOM-kills during rebar3 / erlfmt compilation on low-RAM nodes,
7-
# so we have it pull the prebuilt image instead of rebuilding from source.
8-
#
9-
# Everything (Erlang release, CMD, EXPOSE, PORT) comes baked in via the
10-
# source Dockerfile preserved at Dockerfile.build in this repo.
11-
#
12-
FROM ghcr.io/widgrensit/asobi_site:latest
1+
FROM erlang:28 AS builder
2+
3+
WORKDIR /app
4+
5+
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
6+
7+
COPY rebar.config rebar.lock ./
8+
RUN rebar3 compile --deps_only
9+
10+
COPY config ./config
11+
COPY src ./src
12+
COPY priv ./priv
13+
14+
RUN rebar3 as prod release
15+
16+
FROM debian:trixie-slim
17+
18+
RUN apt-get update && \
19+
apt-get install -y --no-install-recommends \
20+
libssl3 libncurses6 libstdc++6 && \
21+
rm -rf /var/lib/apt/lists/*
22+
23+
WORKDIR /app
24+
25+
COPY --from=builder /app/_build/prod/rel/asobi_site ./
26+
27+
ENV PORT=8080
28+
EXPOSE 8080
29+
30+
CMD ["bin/asobi_site", "foreground"]

Dockerfile.build

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)