diff --git a/README.md b/README.md index 48831e793..e7e88cf13 100644 --- a/README.md +++ b/README.md @@ -181,33 +181,52 @@ you intend to build the website or email newsletter. ### Building the website -*Before attempting to build the website, ensure Docker is in a running state on your system.* - -* Enter the `publishing/` directory: - ```sh - cd publishing - ``` -* Run the Docker build and website local-host command: - ```sh - make build && make generate-website && make host-content - ``` -* View the website locally at default http://localhost:8000, or specific posts - at http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/ - -Note: If looking to test the website's search functionality locally, you will need to adjust the [`TESTING_LOCALLY`](https://github.com/rust-lang/this-week-in-rust/blob/dc127f17fcabbf0f058eb3d5a3febba434ddca83/pelicanconf.py#L7) -variable to `True`. +> [!IMPORTANT] +> +> Before attempting to build the website, ensure Docker is in a running state on +> your system. + +- Enter the `publishing/` directory: + +```sh +cd publishing +``` + +- Run the Docker build and website local-host command: + +```sh +make website +``` + +- View the website locally at default + [http://localhost:8000](http://localhost:8000), or specific posts at + `http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/` + +> [!NOTE] +> +> If looking to test the website's search functionality locally, you will need +> to adjust the +> [`TESTING_LOCALLY`](https://github.com/rust-lang/this-week-in-rust/blob/dc127f17fcabbf0f058eb3d5a3febba434ddca83/pelicanconf.py#L7) +> variable to `True`. ### Building the newsletter -*Before attempting to build the email newsletter, ensure Docker is in a running state on your system.* - -* Enter the `publishing/` directory: - ```sh - cd publishing - ``` -* Run the Docker build and website local-host command: - ```sh - make build && make generate-email && make host-content - ``` -* View the email newsletter formatting of specific posts at - http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/ +> [!IMPORTANT] +> +> Before attempting to build the website, ensure Docker is in a running state on +> your system. + +- Enter the `publishing/` directory: + +```sh +cd publishing +``` + +- Run the Docker build and website local-host command: + +```sh +make email +``` + +- View the email newsletter formatting of specific posts at + `http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/` diff --git a/publishing/Dockerfile b/publishing/Dockerfile index b2216b23c..44894fdf9 100644 --- a/publishing/Dockerfile +++ b/publishing/Dockerfile @@ -1,21 +1,31 @@ -FROM --platform=linux/amd64 python:3.8.16-slim +FROM python:3.8.16-slim -# Must run from base TWIR directory... makefile takes care of this. +# Must run from base `twir` directory... Makefile takes care of this. WORKDIR /usr/twir -RUN apt-get update && apt-get install -y curl build-essential +# Install deps and set locales +RUN apt-get update && apt-get install -y curl build-essential locales \ + && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \ + && locale-gen en_US.UTF-8 \ + && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 -# pelican+friends -ENV LANG='en_US.UTF-8' -ENV LC_ALL='en_US.UTF-8' +# Set explicit locale environment variables +ENV LC_ALL=en_US.UTF-8 +ENV LANG=en_US.UTF-8 +ENV LANGUAGE=en_US.UTF-8 + +# PELICAN+FRIENDS +# install python reqs COPY requirements.txt . RUN pip3 install -r requirements.txt + +# install Stork RUN curl https://files.stork-search.net/releases/v1.5.0/stork-ubuntu-20-04 -o stork \ && chmod +x stork \ && mv ./stork /usr/bin/stork -# sass/juice -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - +# install sass/juice +RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - RUN apt-get install -y nodejs RUN npm install -g sass juice @@ -25,7 +35,8 @@ COPY plugins plugins COPY themes themes COPY pelicanconf.py pelicanconf.py -COPY publishing/*.sh ./ -RUN chmod 777 *.sh +# make build && make generate-website && make host-website needs these scripts +COPY publishing/*.sh . +RUN chmod +x *.sh CMD ["pelican", "--delete-output-directory", "content"] diff --git a/publishing/run_server.sh b/publishing/run_server.sh old mode 100644 new mode 100755