Skip to content

Commit 49baad3

Browse files
committed
chore: add a little Dockerfile
Signed-off-by: Justin Chadwell <me@jedevc.com>
1 parent 8836965 commit 49baad3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
ARG BASE_URL
2+
3+
FROM ubuntu:24.04 AS base
4+
RUN apt-get update && apt-get install -y curl git
5+
6+
FROM node:20-bullseye AS node
7+
WORKDIR /app
8+
COPY package.json yarn.lock ./
9+
RUN yarn install --frozen-lockfile
10+
11+
FROM base AS sass
12+
ARG SASS_VERSION=1.93.1
13+
RUN curl -L -o /tmp/dart-sass.tar.gz https://github.com/sass/dart-sass/releases/download/1.93.1/dart-sass-1.93.1-linux-x64.tar.gz && \
14+
mkdir -p /mnt/dart-sass && \
15+
tar --extract --directory /mnt/dart-sass --file /tmp/dart-sass.tar.gz --strip 2
16+
COPY <<"EOF" /usr/bin/sass
17+
#!/bin/sh
18+
exec "/usr/share/dart-sass/dart" "/usr/share/dart-sass/sass.snapshot" "$@"
19+
EOF
20+
RUN chmod +x /usr/bin/sass && \
21+
mkdir -p /usr/share/dart-sass && \
22+
cp /mnt/dart-sass/dart /usr/share/dart-sass/dart && \
23+
cp /mnt/dart-sass/sass.snapshot /usr/share/dart-sass/sass.snapshot
24+
25+
FROM base AS builder
26+
ARG HUGO_VERSION=0.118.2
27+
RUN curl -L -o /tmp/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
28+
&& dpkg -i /tmp/hugo.deb
29+
COPY --from=sass /usr/bin/sass /usr/bin/sass
30+
COPY --from=sass /usr/share/dart-sass /usr/share/dart-sass
31+
32+
FROM builder AS hugo
33+
WORKDIR /app
34+
COPY . .
35+
COPY --from=node /app/node_modules ./node_modules
36+
ENV HUGO_ENVIRONMENT=production
37+
ENV HUGO_ENV=production
38+
ARG BASE_URL
39+
RUN hugo --gc --minify --baseURL="$BASE_URL"
40+
RUN ls -lha .
41+
42+
FROM scratch
43+
COPY --from=hugo /app/public .

0 commit comments

Comments
 (0)