aboutsummaryrefslogtreecommitdiffstats
path: root/core/Dockerfile
diff options
context:
space:
mode:
authorAstound <kirito@disroot.org>2024-07-19 10:18:24 +0800
committerAstound <kirito@disroot.org>2024-07-19 10:18:24 +0800
commit109c3f1933107995dd110fce3db3fcf6d119ae98 (patch)
tree66f7a0cf0800768c2a3fea4b985c1827c191e896 /core/Dockerfile
parentf9c37b7d5d79c19743771718a2d6ecfdd06d0e17 (diff)
downloadyt-local-docker-109c3f1933107995dd110fce3db3fcf6d119ae98.tar.lz
yt-local-docker-109c3f1933107995dd110fce3db3fcf6d119ae98.tar.xz
yt-local-docker-109c3f1933107995dd110fce3db3fcf6d119ae98.zip
Fix hadolint issues
Diffstat (limited to 'core/Dockerfile')
-rw-r--r--core/Dockerfile49
1 files changed, 23 insertions, 26 deletions
diff --git a/core/Dockerfile b/core/Dockerfile
index b55460c..aa410ed 100644
--- a/core/Dockerfile
+++ b/core/Dockerfile
@@ -1,49 +1,46 @@
-FROM index.docker.io/python:3.11.9-alpine AS base
-LABEL MAINTAINER="heckyel@riseup.net"
+FROM docker.io/python:3.11-alpine AS base
-# Image to Build Dependencies
FROM base AS builder
-ENV LANG C.UTF-8
-ENV LC_ALL C.UTF-8
-
-RUN apk update && apk upgrade && apk add --no-cache musl-dev build-base make gcc g++ libffi-dev git patch
+ENV LANG=C.UTF-8
+ENV LC_ALL=C.UTF-8
ARG APP_DIR="/srv/app"
ARG YT_REPO="https://git.sr.ht/~heckyel/yt-local"
ARG YT_BRANCH="v0.2.18"
-RUN mkdir --parents "$APP_DIR"
-
-WORKDIR "$APP_DIR"
-
-RUN git clone --depth=1 "$YT_REPO" --branch "$YT_BRANCH" "$APP_DIR" && \
-git show --oneline --no-patch
-RUN pip install --upgrade pip && \
-pip install --no-cache-dir --prefix=/install wheel gunicorn
-RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
+RUN apk update && \
+apk upgrade && \
+apk add --no-cache musl-dev build-base make gcc g++ libffi-dev git patch && \
+mkdir -p "$APP_DIR" && \
+git clone --depth=1 "$YT_REPO" --branch "$YT_BRANCH" "$APP_DIR" && \
+git -C "$APP_DIR" show --oneline --no-patch && \
+pip install --upgrade pip && \
+pip install --no-cache-dir --prefix=/install wheel gunicorn && \
+pip install --no-cache-dir --prefix=/install -r "$APP_DIR/requirements.txt"
COPY 0001.patch "$APP_DIR/0001.patch"
-RUN patch -Np1 -i "$APP_DIR/0001.patch"
-# clean
-RUN rm -f "$APP_DIR/0001.patch" && apk del git patch
+RUN patch -Np1 -i "$APP_DIR/0001.patch" -d "$APP_DIR" && \
+rm -f "$APP_DIR/0001.patch" && \
+apk del git patch
-# Runtime Environment Image
FROM base
-WORKDIR /srv/app
+ARG APP_DIR="/srv/app"
+WORKDIR "$APP_DIR"
+
+RUN apk update && \
+apk upgrade && \
+apk add --no-cache tor curl
-# Runtime Dependencies
-RUN apk update && apk upgrade && apk --no-cache add tor curl
COPY --from=builder /install /usr/local
-COPY --from=builder /srv/app /srv/app
+COPY --from=builder "$APP_DIR" "$APP_DIR"
EXPOSE 8080
COPY entrypoint-tor.sh /
COPY entrypoint.sh /
-RUN chmod u+x /entrypoint-tor.sh
-RUN chmod u+x /entrypoint.sh
+RUN chmod u+x /entrypoint-tor.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]