Skip to content

Commit

Permalink
dockerfile fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
justinthelaw committed Aug 8, 2024
1 parent df61f94 commit ddfecad
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
- uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0
with:
dockerfile: "*Dockerfile*"
failure-threshold: error
recursive: true
config: .hadolint.yaml
8 changes: 8 additions & 0 deletions .hadolint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
failure-threshold: error
# ignore: use of latest, --no-cache-dir, shell usage warning, apt-get list, --no-install-recommends
ignored:
- "DL3007"
- "DL3042"
- "DL4006"
- "DL3009"
- "DL3015"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ repos:
hooks:
- id: hadolint-docker
name: Dockerfile Lint
args: ["--failure-threshold", "error"]
args: ["--config", ".hadolint.yaml"]

- repo: local
hooks:
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile.migrations
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM cgr.dev/chainguard/bash:latest
ARG TARGETPLATFORM
ARG version="1.169.8"
ARG MIGRATIONS_DIR

ARG TARGETPLATFORM \
version="1.169.8" \
MIGRATIONS_DIR

RUN test -n "$MIGRATIONS_DIR" || (echo "MIGRATIONS_PATH is required" && false)

# Download the supabase cli
RUN mkdir -p /usr/local/bin
RUN ARCH=$(echo $TARGETPLATFORM | cut -d '/' -f2) \
RUN mkdir -p /usr/local/bin \

Check failure on line 10 in Dockerfile.migrations

View workflow job for this annotation

GitHub Actions / Lint Docker Manifest

SC2086 info: Double quote to prevent globbing and word splitting.
ARCH=$(echo $TARGETPLATFORM | cut -d "/" -f2) \
&& curl -LO https://github.com/supabase/cli/releases/download/v${version}/supabase_linux_${ARCH}.tar.gz \
&& tar -xzf supabase_linux_${ARCH}.tar.gz -C /usr/local/bin/ \
&& rm supabase_linux_${ARCH}.tar.gz
Expand Down
2 changes: 1 addition & 1 deletion packages/llama-cpp-python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ COPY --from=builder /leapfrogai/.venv/ /leapfrogai/.venv/
COPY packages/llama-cpp-python/main.py .
COPY packages/llama-cpp-python/config.yaml .

EXPOSE 50051:50051
EXPOSE 50051

ENTRYPOINT ["python", "-m", "leapfrogai_sdk.cli", "--app-dir=.", "main:Model"]
2 changes: 1 addition & 1 deletion packages/repeater/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ COPY --from=builder /leapfrogai/.venv/ /leapfrogai/.venv/
COPY packages/repeater/repeater.py .

# Publish port
EXPOSE 50051:50051
EXPOSE 50051

# Run the repeater model
ENTRYPOINT ["python", "-u", "repeater.py"]
2 changes: 1 addition & 1 deletion packages/text-embeddings/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ COPY --from=builder /leapfrogai/.venv/ /leapfrogai/.venv/

COPY packages/text-embeddings/main.py .

EXPOSE 50051:50051
EXPOSE 50051

ENTRYPOINT ["python", "-u", "main.py"]
2 changes: 1 addition & 1 deletion packages/vllm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@ ENV LAI_PROMPT_FORMAT_CHAT_USER=${PROMPT_FORMAT_CHAT_USER}
ENV LAI_PROMPT_FORMAT_DEFAULTS_TOP_P=${PROMPT_FORMAT_DEFAULTS_TOP_P}
ENV LAI_PROMPT_FORMAT_DEFAULTS_TOP_K=${PROMPT_FORMAT_DEFAULTS_TOP_K}

EXPOSE 50051:50051
EXPOSE 50051

ENTRYPOINT ["python", "-m", "leapfrogai_sdk.cli", "--app-dir=packages/vllm/src/", "main:Model"]
2 changes: 1 addition & 1 deletion packages/whisper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ ENV LD_LIBRARY_PATH \

COPY packages/whisper/main.py .

EXPOSE 50051:50051
EXPOSE 50051

ENTRYPOINT ["python", "-u", "main.py"]
7 changes: 4 additions & 3 deletions src/leapfrogai_sdk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM ghcr.io/defenseunicorns/leapfrogai/python:3.11-dev AS builder

ARG SDK_DEST=src/leapfrogai_sdk/build
USER root

WORKDIR /leapfrogai

COPY ./src/leapfrogai_sdk /leapfrogai/src/leapfrogai_sdk

RUN python -m venv .venv
ENV PATH="/leapfrogai/.venv/bin:$PATH"
RUN rm -f ${SDK_DEST}/*.whl
RUN python -m pip wheel src/leapfrogai_sdk -w ${SDK_DEST}

RUN rm -f ${SDK_DEST}/*.whl \
python -m pip wheel src/leapfrogai_sdk -w ${SDK_DEST}
20 changes: 14 additions & 6 deletions src/leapfrogai_ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
FROM node:18-alpine AS builder

WORKDIR /app

COPY package.json ./
COPY package-lock.json ./

RUN npm ci

COPY . .

ENV NODE_ENV=production
RUN npm run build
RUN npm prune

RUN npm run build && \
npm prune

FROM cgr.dev/chainguard/node:latest

Expand All @@ -15,9 +21,11 @@ COPY --chown=node:node --from=builder /app/build build/
COPY --chown=node:node --from=builder /app/node_modules node_modules/
COPY --chown=node:node package.json .
EXPOSE 3000
ENV NODE_ENV=production

# Disable request size limit
ENV BODY_SIZE_LIMIT=Infinity
ENV PROTOCOL_HEADER=x-forwarded-proto
ENV HOST_HEADER=x-forwarded-host
ENV BODY_SIZE_LIMIT=Infinity \
NODE_ENV=production \
PROTOCOL_HEADER=x-forwarded-proto \
HOST_HEADER=x-forwarded-host

CMD ["build"]

0 comments on commit ddfecad

Please sign in to comment.