adowu commited on
Commit
272149c
·
verified ·
1 Parent(s): 3332d19

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -8
Dockerfile CHANGED
@@ -1,17 +1,21 @@
 
1
  FROM alpine:3.19
2
 
 
3
  WORKDIR /code
 
 
4
  RUN git clone https://github.com/searxng/searxng
5
- ENTRYPOINT ["/sbin/tini","--","/code/searxng/dockerfiles/docker-entrypoint.sh"]
6
- EXPOSE 8080
7
- VOLUME /etc/searxng
8
 
 
9
  ARG SEARXNG_GID=977
10
  ARG SEARXNG_UID=977
11
 
 
12
  RUN addgroup -g ${SEARXNG_GID} searxng && \
13
  adduser -u ${SEARXNG_UID} -D -h /code/searxng -s /bin/sh -G searxng searxng
14
 
 
15
  ENV INSTANCE_NAME=searxng \
16
  AUTOCOMPLETE= \
17
  BASE_URL= \
@@ -22,8 +26,7 @@ ENV INSTANCE_NAME=searxng \
22
  UWSGI_WORKERS=%k \
23
  UWSGI_THREADS=4
24
 
25
-
26
-
27
  COPY requirements.txt ./requirements.txt
28
 
29
  RUN apk add --no-cache -t build-dependencies \
@@ -52,13 +55,15 @@ RUN apk add --no-cache -t build-dependencies \
52
  && apk del build-dependencies \
53
  && rm -rf /root/.cache
54
 
55
- COPY --chown=searxng:searxng dockerfiles ./dockerfiles
56
  COPY --chown=searxng:searxng searx ./searx
57
 
 
58
  ARG TIMESTAMP_SETTINGS=0
59
  ARG TIMESTAMP_UWSGI=0
60
  ARG VERSION_GITCOMMIT=unknown
61
 
 
62
  RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
63
  && touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
64
  && touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
@@ -66,7 +71,7 @@ RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
66
  -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
67
  -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
68
 
69
- # Keep these arguments at the end to prevent redundant layer rebuilds
70
  ARG LABEL_DATE=
71
  ARG GIT_URL=unknown
72
  ARG SEARXNG_GIT_VERSION=unknown
@@ -90,4 +95,4 @@ LABEL maintainer="searxng <${GIT_URL}>" \
90
  org.opencontainers.image.revision=${LABEL_VCS_REF} \
91
  org.opencontainers.image.source=${LABEL_VCS_URL} \
92
  org.opencontainers.image.created="${LABEL_DATE}" \
93
- org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker"
 
1
+ # Use Alpine Linux 3.19 as the base image
2
  FROM alpine:3.19
3
 
4
+ # Set working directory within the container
5
  WORKDIR /code
6
+
7
+ # Clone the searxng repository
8
  RUN git clone https://github.com/searxng/searxng
 
 
 
9
 
10
+ # Set arguments for user and group IDs (default to 977 if not provided)
11
  ARG SEARXNG_GID=977
12
  ARG SEARXNG_UID=977
13
 
14
+ # Add a non-root user and group for running the application
15
  RUN addgroup -g ${SEARXNG_GID} searxng && \
16
  adduser -u ${SEARXNG_UID} -D -h /code/searxng -s /bin/sh -G searxng searxng
17
 
18
+ # Set environment variables for the application
19
  ENV INSTANCE_NAME=searxng \
20
  AUTOCOMPLETE= \
21
  BASE_URL= \
 
26
  UWSGI_WORKERS=%k \
27
  UWSGI_THREADS=4
28
 
29
+ # Copy requirements.txt to the working directory and install dependencies
 
30
  COPY requirements.txt ./requirements.txt
31
 
32
  RUN apk add --no-cache -t build-dependencies \
 
55
  && apk del build-dependencies \
56
  && rm -rf /root/.cache
57
 
58
+ # Copy application files and set ownership to searxng user and group
59
  COPY --chown=searxng:searxng searx ./searx
60
 
61
+ # Set build arguments for timestamps and version info
62
  ARG TIMESTAMP_SETTINGS=0
63
  ARG TIMESTAMP_UWSGI=0
64
  ARG VERSION_GITCOMMIT=unknown
65
 
66
+ # Compile Python files, set timestamps, and compress static assets
67
  RUN su searxng -c "/usr/bin/python3 -m compileall -q searx" \
68
  && touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml \
69
  && touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini \
 
71
  -o -name '*.svg' -o -name '*.ttf' -o -name '*.eot' \) \
72
  -type f -exec gzip -9 -k {} \+ -exec brotli --best {} \+
73
 
74
+ # Define metadata labels for the Docker image
75
  ARG LABEL_DATE=
76
  ARG GIT_URL=unknown
77
  ARG SEARXNG_GIT_VERSION=unknown
 
95
  org.opencontainers.image.revision=${LABEL_VCS_REF} \
96
  org.opencontainers.image.source=${LABEL_VCS_URL} \
97
  org.opencontainers.image.created="${LABEL_DATE}" \
98
+ org.opencontainers.image.documentation="https://github.com/searxng/searxng-docker"