From 876786f4d20aebc0a0be17eb65d6857520cad58d Mon Sep 17 00:00:00 2001 From: Tobias Neitzel Date: Wed, 24 Jul 2024 16:22:01 +0200 Subject: [PATCH] Add dev script and Dockerfile.dev --- frontend/Dockerfile.dev | 19 +++++++++++++++++++ frontend/dev.sh | 13 +++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 frontend/Dockerfile.dev create mode 100755 frontend/dev.sh diff --git a/frontend/Dockerfile.dev b/frontend/Dockerfile.dev new file mode 100644 index 0000000..fd695f0 --- /dev/null +++ b/frontend/Dockerfile.dev @@ -0,0 +1,19 @@ +FROM node:lts-alpine + +WORKDIR /app +COPY package*.json . + +RUN adduser --gecos '' --disabled-password rpv \ + && chown -R rpv:rpv /app \ + && su rpv -c "npm install" \ + && su rpv -c "npm install http-server" + +COPY . . + +RUN chown -R rpv:rpv /app \ + && su rpv -c "npm run build" + +USER rpv:rpv +EXPOSE 5173 + +CMD ["npm", "run", "dev", "--", "--host"] diff --git a/frontend/dev.sh b/frontend/dev.sh new file mode 100755 index 0000000..62e1cf7 --- /dev/null +++ b/frontend/dev.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +podman image exists rpv-web-dev + +if [ $? -ne 0 ]; then + echo '[+] Building rpv-web-dev image.' + podman build -t rpv-web-dev -f Dockerfile.dev . +else + echo '[+] rpv-web-dev image already exists.' +fi + +echo '[+] Starting rpv-web-dev container.' +podman run -v ${PWD}/src/:/app/src:Z -it -p 5173:5173 rpv-web-dev