+7
-5
Dockerfile
+7
-5
Dockerfile
···
15
15
ARG OTP_VERSION=26.0.2
16
16
ARG DEBIAN_VERSION=bullseye-20230612-slim
17
17
18
-
ARG BUILDER_IMAGE="hexpm/elixir:${ELIXIR_VERSION}-erlang-${OTP_VERSION}-debian-${DEBIAN_VERSION}"
19
-
ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
18
+
ARG BUILDER_IMAGE="hexpm/elixir:1.15.7-erlang-26.1.2-debian-bullseye-20231009-slim"
19
+
ARG RUNNER_IMAGE="debian:bullseye-20231009-slim"
20
20
21
21
FROM ${BUILDER_IMAGE} as builder
22
22
···
39
39
RUN mix deps.get --only $MIX_ENV
40
40
RUN mkdir config
41
41
42
-
# Copy config/runtime.exs from your project
42
+
# Copy compile-time config files before we compile dependencies
43
+
# to ensure any relevant config change will trigger the dependencies
44
+
# to be re-compiled.
43
45
COPY config/config.exs config/${MIX_ENV}.exs config/
44
46
RUN mix deps.compile
45
47
···
65
67
# the compiled release and other runtime necessities
66
68
FROM ${RUNNER_IMAGE}
67
69
68
-
RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales \
70
+
RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales imagemagick \
69
71
&& apt-get clean && rm -f /var/lib/apt/lists/*_*
70
72
71
73
# Set the locale
···
86
88
87
89
USER nobody
88
90
89
-
CMD ["/app/bin/server"]
91
+
CMD ["/app/bin/server"]
+1
lib/blog/content/image_generator.ex
+1
lib/blog/content/image_generator.ex
···
1
+
+1
-1
lib/blog_web.ex
+1
-1
lib/blog_web.ex
+8
-2
lib/blog_web/live/post_live.ex
+8
-2
lib/blog_web/live/post_live.ex
···
146
146
147
147
defp assign_meta_tags(socket, post) do
148
148
description = get_preview(post.body)
149
+
image_path = Blog.Content.ImageGenerator.ensure_post_image(post.slug)
150
+
image_url = url(socket, image_path)
149
151
150
152
assign(socket,
151
153
page_title: post.title,
···
155
157
%{property: "og:description", content: description},
156
158
%{property: "og:type", content: "article"},
157
159
%{property: "og:site_name", content: "Thoughts and Tidbits"},
160
+
%{property: "og:image", content: image_url},
161
+
%{property: "og:image:width", content: "1200"},
162
+
%{property: "og:image:height", content: "630"},
158
163
%{property: "article:published_time",
159
164
content: DateTime.from_naive!(post.written_on, "Etc/UTC") |> DateTime.to_iso8601()},
160
-
%{name: "twitter:card", content: "summary"},
165
+
%{name: "twitter:card", content: "summary_large_image"},
161
166
%{name: "twitter:title", content: post.title},
162
-
%{name: "twitter:description", content: description}
167
+
%{name: "twitter:description", content: description},
168
+
%{name: "twitter:image", content: image_url}
163
169
] ++ tag_meta_tags(post.tags)
164
170
)
165
171
end