Skip to content

Commit 0b74deb

Browse files
authored
Merge pull request #7072 from andreacfromtheapp/fix-docker-build-4865
fix: issue 4865 Docker build failed
2 parents f167009 + 62a2119 commit 0b74deb

File tree

3 files changed

+67
-37
lines changed

3 files changed

+67
-37
lines changed

README.md

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -181,33 +181,52 @@ you intend to build the website or email newsletter.
181181

182182
### Building the website
183183

184-
*Before attempting to build the website, ensure Docker is in a running state on your system.*
185-
186-
* Enter the `publishing/` directory:
187-
```sh
188-
cd publishing
189-
```
190-
* Run the Docker build and website local-host command:
191-
```sh
192-
make build && make generate-website && make host-content
193-
```
194-
* View the website locally at default http://localhost:8000, or specific posts
195-
at http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/
196-
197-
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)
198-
variable to `True`.
184+
> [!IMPORTANT]
185+
>
186+
> Before attempting to build the website, ensure Docker is in a running state on
187+
> your system.
188+
189+
- Enter the `publishing/` directory:
190+
191+
```sh
192+
cd publishing
193+
```
194+
195+
- Run the Docker build and website local-host command:
196+
197+
```sh
198+
make website
199+
```
200+
201+
- View the website locally at default
202+
[http://localhost:8000](http://localhost:8000), or specific posts at
203+
`http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/`
204+
205+
> [!NOTE]
206+
>
207+
> If looking to test the website's search functionality locally, you will need
208+
> to adjust the
209+
> [`TESTING_LOCALLY`](https://github.com/rust-lang/this-week-in-rust/blob/dc127f17fcabbf0f058eb3d5a3febba434ddca83/pelicanconf.py#L7)
210+
> variable to `True`.
199211
200212
### Building the newsletter
201213

202-
*Before attempting to build the email newsletter, ensure Docker is in a running state on your system.*
203-
204-
* Enter the `publishing/` directory:
205-
```sh
206-
cd publishing
207-
```
208-
* Run the Docker build and website local-host command:
209-
```sh
210-
make build && make generate-email && make host-content
211-
```
212-
* View the email newsletter formatting of specific posts at
213-
http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/
214+
> [!IMPORTANT]
215+
>
216+
> Before attempting to build the website, ensure Docker is in a running state on
217+
> your system.
218+
219+
- Enter the `publishing/` directory:
220+
221+
```sh
222+
cd publishing
223+
```
224+
225+
- Run the Docker build and website local-host command:
226+
227+
```sh
228+
make email
229+
```
230+
231+
- View the email newsletter formatting of specific posts at
232+
`http://localhost:8000/blog/{YEAR}/{MONTH}/{DAY}/{ISSUE}/`

publishing/Dockerfile

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1-
FROM --platform=linux/amd64 python:3.8.16-slim
1+
FROM python:3.8.16-slim
22

3-
# Must run from base TWIR directory... makefile takes care of this.
3+
# Must run from base `twir` directory... Makefile takes care of this.
44
WORKDIR /usr/twir
55

6-
RUN apt-get update && apt-get install -y curl build-essential
6+
# Install deps and set locales
7+
RUN apt-get update && apt-get install -y curl build-essential locales \
8+
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
9+
&& locale-gen en_US.UTF-8 \
10+
&& update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8
711

8-
# pelican+friends
9-
ENV LANG='en_US.UTF-8'
10-
ENV LC_ALL='en_US.UTF-8'
12+
# Set explicit locale environment variables
13+
ENV LC_ALL=en_US.UTF-8
14+
ENV LANG=en_US.UTF-8
15+
ENV LANGUAGE=en_US.UTF-8
16+
17+
# PELICAN+FRIENDS
18+
# install python reqs
1119
COPY requirements.txt .
1220
RUN pip3 install -r requirements.txt
21+
22+
# install Stork
1323
RUN curl https://files.stork-search.net/releases/v1.5.0/stork-ubuntu-20-04 -o stork \
1424
&& chmod +x stork \
1525
&& mv ./stork /usr/bin/stork
1626

17-
# sass/juice
18-
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
27+
# install sass/juice
28+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
1929
RUN apt-get install -y nodejs
2030
RUN npm install -g sass juice
2131

@@ -25,7 +35,8 @@ COPY plugins plugins
2535
COPY themes themes
2636
COPY pelicanconf.py pelicanconf.py
2737

28-
COPY publishing/*.sh ./
29-
RUN chmod 777 *.sh
38+
# make build && make generate-website && make host-website needs these scripts
39+
COPY publishing/*.sh .
40+
RUN chmod +x *.sh
3041

3142
CMD ["pelican", "--delete-output-directory", "content"]

publishing/run_server.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)