From 109c3f1933107995dd110fce3db3fcf6d119ae98 Mon Sep 17 00:00:00 2001 From: Astound Date: Fri, 19 Jul 2024 10:18:24 +0800 Subject: Fix hadolint issues --- core/Dockerfile | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'core') 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"] -- cgit v1.2.3