mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-17 18:58:33 +00:00
fix: Harden Dockerfile
This commit is contained in:
parent
463ece02c7
commit
cbfb8432f8
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
.gitignore
|
||||
Dockerfile
|
||||
README.md
|
||||
docs
|
21
Dockerfile
21
Dockerfile
@ -1,15 +1,20 @@
|
||||
FROM node:18-bullseye-slim
|
||||
FROM node:20-slim
|
||||
WORKDIR /app
|
||||
EXPOSE 9000
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y git
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
RUN git clone -n https://github.com/wukko/cobalt.git --depth 1 && mv cobalt/.git ./ && rm -rf cobalt
|
||||
RUN apt-get install -y git
|
||||
|
||||
COPY . .
|
||||
EXPOSE 9000
|
||||
|
||||
RUN npm install
|
||||
|
||||
# Drop privileges
|
||||
RUN groupadd cobalt && useradd -g cobalt cobalt
|
||||
RUN chown -R cobalt:cobalt /app
|
||||
RUN chmod -R 755 /app
|
||||
|
||||
USER cobalt
|
||||
|
||||
CMD [ "node", "src/cobalt" ]
|
||||
|
Loading…
Reference in New Issue
Block a user