diff --git a/.github/workflows/docker-latex.yml b/.github/workflows/docker-latex.yml index c9aa08a..816df29 100644 --- a/.github/workflows/docker-latex.yml +++ b/.github/workflows/docker-latex.yml @@ -54,7 +54,7 @@ jobs: - name: Build pdf using docker image run: | - docker run --rm -v "$(pwd):/home/porter/app" --name maths --user root --hostname latex latex sh ./deploy.sh --parallel --production --dist-dir="web/dist" --cache-uri="https://maths.nrv.nu/pdf/archive.tar.gz" + docker run --rm -v "$(pwd):/app" --name maths --user root --hostname latex latex sh ./deploy.sh --parallel --production --dist-dir="web/dist" --cache-uri="https://notes.nrv.nu/pdf/archive.tar.gz" - name: Upload site artifact uses: actions/upload-pages-artifact@v2 diff --git a/Dockerfile b/Dockerfile index 8ea7cba..321f183 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,16 @@ FROM alpine:latest -RUN apk update && apk upgrade;\ - apk add doas;\ - adduser -g 'Porter' porter;\ - echo "porter:" | chpasswd;\ - adduser porter wheel;\ +# Set environment variables for UID and GID (can be passed at runtime) +ARG USER_ID=1000 +ARG GROUP_ID=1000 + +# Update packages and add required utilities +RUN apk update && apk upgrade; \ + apk add doas; \ + addgroup -g ${GROUP_ID} porter; \ + adduser -D -u ${USER_ID} -G porter -g 'Porter' porter; \ + echo "porter:" | chpasswd; \ + addgroup porter wheel; \ echo "permit persist :wheel" > "/etc/doas.d/doas.conf" # Run system config script @@ -24,18 +30,17 @@ COPY compile.sh /home/porter RUN chown -R porter /home/porter/.docker &&\ chown porter /home/porter/compile.sh +RUN mkdir -p /app +RUN chown -R porter /app + USER porter WORKDIR /home/porter -## Set zsh as default shell -#RUN echo "porter:" | chsh -s $(which zsh) porter - # Run setup.sh as porter RUN sh .docker/setup.sh # Set final working directory -RUN mkdir -p /home/porter/app -WORKDIR /home/porter/app +WORKDIR /app CMD ["zsh"] diff --git a/README.md b/README.md index d35316b..c4525f5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Math Notes +# Notes Alpine container with LaTeX and neovim installation. @@ -10,12 +10,16 @@ Build docker image. docker build -t latex . ``` +```sh +docker build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) -t latex . +``` + ## Run Start latex docker image. ```sh -docker run -it --rm -v "$(pwd):/home/porter/app" --hostname latex --name maths latex +docker run -it --rm -v "$(pwd):/app" --name maths latex ``` ## Python Environment diff --git a/web/src/App.svelte b/web/src/App.svelte index cc3fb33..6afb93b 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -36,7 +36,7 @@