Skip to content

Commit a198c3e

Browse files
committed
Fix Docker image
1 parent 47021fc commit a198c3e

File tree

5 files changed

+117
-0
lines changed

5 files changed

+117
-0
lines changed

.dockerignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*
2+
!.git/
3+
!docker/
4+
!source/
5+
!Makefile
6+
!pyproject.toml
7+
!poetry.lock
8+
!scripts/
9+
!ci/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ venv*/
55
virtualenv*/
66
venv*/
77
.idea/
8+
docker-compose.yml

Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
FROM python:3-alpine as builder
2+
3+
RUN apk add --no-cache gcc musl-dev libffi-dev rust cargo openssl-dev poetry make git bash
4+
5+
# build as a regular user, not root, to avoid annoying warnings from pip
6+
RUN adduser -S build
7+
RUN install -d -m 0755 -o build /build
8+
USER build
9+
WORKDIR /build
10+
11+
COPY pyproject.toml /build/
12+
COPY poetry.lock /build/
13+
14+
RUN poetry install
15+
16+
COPY --chown=build . .
17+
18+
RUN git config --global --add safe.directory /build
19+
20+
RUN poetry run make epub && \
21+
epub_filename=AppImage-documentation-git"$(date +%Y%m%d)"."$(git rev-parse --short HEAD)".epub && \
22+
mkdir -p build/html/download && \
23+
cp build/epub/AppImage.epub build/html/download/"$epub_filename" && \
24+
bash -xe ci/embed-epub-link.sh "$epub_filename" && \
25+
poetry run make html
26+
27+
28+
FROM python:3-alpine as libappimage-builder
29+
30+
RUN apk add --no-cache git make doxygen gcc musl-dev libxml2-dev libxslt-dev
31+
32+
WORKDIR /tmp
33+
34+
RUN git clone https://github.com/AppImage/libappimage.git && \
35+
cd libappimage/docs && \
36+
pip install -r requirements.txt breathe exhale && \
37+
make html
38+
39+
# deployment container
40+
FROM nginx:1-alpine
41+
42+
LABEL org.opencontainers.image.source="https://github.com/AppImage/AppImageKit"
43+
44+
COPY docker/nginx.conf /etc/nginx/
45+
46+
# check nginx config
47+
RUN nginx -t
48+
49+
COPY --from=builder /build/build/html/ /usr/share/nginx/html
50+
COPY --from=libappimage-builder /tmp/libappimage/docs/_build/html/ /usr/share/nginx/html/api/libappimage

docker-compose.yml.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
services:
2+
web:
3+
build: .
4+
ports:
5+
- 8123:80

docker/nginx.conf

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
user nginx;
2+
worker_processes 1;
3+
4+
error_log /var/log/nginx/error.log warn;
5+
pid /var/run/nginx.pid;
6+
7+
8+
events {
9+
worker_connections 1024;
10+
}
11+
12+
13+
http {
14+
include /etc/nginx/mime.types;
15+
default_type application/octet-stream;
16+
17+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
18+
'$status $body_bytes_sent "$http_referer" '
19+
'"$http_user_agent" "$http_x_forwarded_for"';
20+
21+
access_log /var/log/nginx/access.log main;
22+
23+
sendfile on;
24+
#tcp_nopush on;
25+
26+
keepalive_timeout 65;
27+
28+
#gzip on;
29+
30+
server {
31+
listen 80;
32+
server_name localhost;
33+
34+
location / {
35+
root /usr/share/nginx/html;
36+
}
37+
38+
error_page 404 /error-pages/404.html;
39+
40+
# redirect server error pages to the static page /50x.html
41+
#
42+
error_page 500 502 503 504 /50x.html;
43+
location = /50x.html {
44+
root /usr/share/nginx/html;
45+
}
46+
47+
# deny access to all hidden files
48+
location ~ /\. {
49+
deny all;
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)