Fix hadolint issues

This commit is contained in:
Astound 2024-07-19 10:18:24 +08:00
parent f9c37b7d5d
commit 109c3f1933
Signed by: kaiser
GPG Key ID: 97504AF0027B1A56

View File

@ -1,49 +1,46 @@
FROM index.docker.io/python:3.11.9-alpine AS base FROM docker.io/python:3.11-alpine AS base
LABEL MAINTAINER="heckyel@riseup.net"
# Image to Build Dependencies
FROM base AS builder FROM base AS builder
ENV LANG C.UTF-8 ENV LANG=C.UTF-8
ENV LC_ALL 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
ARG APP_DIR="/srv/app" ARG APP_DIR="/srv/app"
ARG YT_REPO="https://git.sr.ht/~heckyel/yt-local" ARG YT_REPO="https://git.sr.ht/~heckyel/yt-local"
ARG YT_BRANCH="v0.2.18" ARG YT_BRANCH="v0.2.18"
RUN mkdir --parents "$APP_DIR" RUN apk update && \
apk upgrade && \
WORKDIR "$APP_DIR" apk add --no-cache musl-dev build-base make gcc g++ libffi-dev git patch && \
mkdir -p "$APP_DIR" && \
RUN git clone --depth=1 "$YT_REPO" --branch "$YT_BRANCH" "$APP_DIR" && \ git clone --depth=1 "$YT_REPO" --branch "$YT_BRANCH" "$APP_DIR" && \
git show --oneline --no-patch git -C "$APP_DIR" show --oneline --no-patch && \
RUN pip install --upgrade pip && \ pip install --upgrade pip && \
pip install --no-cache-dir --prefix=/install wheel gunicorn pip install --no-cache-dir --prefix=/install wheel gunicorn && \
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt pip install --no-cache-dir --prefix=/install -r "$APP_DIR/requirements.txt"
COPY 0001.patch "$APP_DIR/0001.patch" COPY 0001.patch "$APP_DIR/0001.patch"
RUN patch -Np1 -i "$APP_DIR/0001.patch"
# clean RUN patch -Np1 -i "$APP_DIR/0001.patch" -d "$APP_DIR" && \
RUN rm -f "$APP_DIR/0001.patch" && apk del git patch rm -f "$APP_DIR/0001.patch" && \
apk del git patch
# Runtime Environment Image
FROM base 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 /install /usr/local
COPY --from=builder /srv/app /srv/app COPY --from=builder "$APP_DIR" "$APP_DIR"
EXPOSE 8080 EXPOSE 8080
COPY entrypoint-tor.sh / COPY entrypoint-tor.sh /
COPY entrypoint.sh / COPY entrypoint.sh /
RUN chmod u+x /entrypoint-tor.sh RUN chmod u+x /entrypoint-tor.sh /entrypoint.sh
RUN chmod u+x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]