Skip to content

Commit

Permalink
Create rootless Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorel-35 committed Aug 24, 2024
1 parent 17c0af1 commit d1d66a3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ permissions:
contents: write

jobs:
docker-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: hadolint/hadolint-action@v3
with:
verbose: true
lint:
runs-on: ubuntu-latest
steps:
Expand Down
19 changes: 17 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,17 @@
FROM node:20.12.2-alpine3.19 AS base
RUN wget -qO- https://get.pnpm.io/install.sh | ENV="$HOME/.shrc" SHELL="$(which sh)" sh -
FROM node:20.12.2-alpine3.19

USER 0:0

RUN npm install -g pnpm \
&& addgroup -g 1001 mermaid \
&& adduser -u 1001 -G mermaid -h /home/mermaid -D mermaid \
&& mkdir -p /workspaces/mermaid \
&& chown mermaid:mermaid /workspaces/mermaid

ENV NODE_OPTIONS="--max_old_space_size=8192"

USER 1000:1000

WORKDIR /workspaces/mermaid

EXPOSE 9000 3333
23 changes: 10 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ services:
dockerfile: Dockerfile
stdin_open: true
tty: true
working_dir: /mermaid
working_dir: /workspaces/mermaid
mem_limit: '8G'
entrypoint: ./docker-entrypoint.sh
environment:
- NODE_OPTIONS=--max_old_space_size=8192
volumes:
- ./:/mermaid
- root_cache:/root/.cache
- root_local:/root/.local
- root_npm:/root/.npm
- ./:/workspaces/mermaid
- user_cache:/home/mermaid/.cache
- user_local:/home/mermaid/.local
- user_npm:/home/mermaid/.npm
- /tmp:/tmp
ports:
- 9000:9000
Expand All @@ -23,17 +20,17 @@ services:
image: cypress/included:13.7.3
stdin_open: true
tty: true
working_dir: /mermaid
working_dir: /workspaces/mermaid
mem_limit: '2G'
entrypoint: cypress
environment:
- DISPLAY
volumes:
- ./:/mermaid
- ./:/workspaces/mermaid
- /tmp/.X11-unix:/tmp/.X11-unix
network_mode: host

volumes:
root_cache:
root_local:
root_npm:
user_cache:
user_local:
user_npm:
3 changes: 0 additions & 3 deletions docker-entrypoint.sh

This file was deleted.

0 comments on commit d1d66a3

Please sign in to comment.