alpine-eslint/Dockerfile: update

This commit is contained in:
Haitao Pan 2024-04-27 15:36:44 +08:00
parent c583369eef
commit 4bc2fc2d7e
2 changed files with 19 additions and 65 deletions

View File

@ -1,55 +0,0 @@
# Stage 1: Build environment
FROM alpine:3.12 as builder
# Install build dependencies
RUN apk add --no-cache \
git \
curl \
python3 \
python3-dev \
py3-pip \
go \
nodejs \
npm \
yaml-dev \
libffi-dev \
gcc \
musl-dev
# Install pip and Ansible
RUN pip3 install --upgrade pip
RUN pip3 install ansible ansible-lint
# Set up Go, install Go dependencies
RUN go get -u golang.org/x/lint/golint
# Install yamllint
RUN pip3 install yamllint
# Set up Node.js and npm, install eslint and React plugin
RUN npm install -g eslint eslint-plugin-react
# Stage 2: Final image
FROM alpine:3.12
# Copy necessary files from the builder stage
COPY --from=builder /usr/bin/python3 /usr/bin/python3
COPY --from=builder /usr/lib/python3.8 /usr/lib/python3.8
COPY --from=builder /usr/bin/go /usr/bin/go
COPY --from=builder /root/go /root/go
COPY --from=builder /usr/bin/node /usr/bin/node
COPY --from=builder /usr/lib/node_modules /usr/lib/node_modules
# Create symbolic links for python and pip
RUN ln -s /usr/bin/python3 /usr/bin/python
RUN ln -s /usr/bin/python3 /usr/bin/pip
# Ensure the tools are in the PATH
ENV PATH="/root/go/bin:/usr/lib/node_modules/.bin:${PATH}"
# Set work directory
WORKDIR /src
# Define an entrypoint
ENTRYPOINT ["/bin/sh"]

View File

@ -1,15 +1,24 @@
FROM alpine:3.12
FROM node:lts-alpine
# Install Node.js and npm
RUN apk add --no-cache \
nodejs \
npm
# Install bash, git, and curl
RUN apk add --no-cache bash git curl && \
npm install -g eslint && \
npm install -g next && \
npm install -g jest && \
npm install -g ts-node && \
npm install -g typescript && \
npm install -g next-translate && \
npm install -g next-translate-plugin
# Install eslint
RUN npm install -g eslint
# Install gitleaks using binary installation
RUN wget https://mirrors.onwalk.net/tools/gitleaks_8.2.4_linux_x64.tar.gz \
&& tar -xf gitleaks_8.2.4_linux_x64.tar.gz \
&& mv gitleaks /usr/bin/ \
&& rm gitleaks_8.2.4_linux_x64.tar.gz
# Set work directory
# Set the working directory
WORKDIR /src
# Define an entrypoint
ENTRYPOINT ["eslint"]
ENTRYPOINT ["/bin/bash"]
# Define the default command to start bash
CMD ["/bin/bash"]