44# pull official base image
55FROM python:3.13.2-alpine as builder
66
7+ # Build args for UID/GID
8+ ARG UID=1000
9+ ARG GID=1000
10+
711# set work directory
812WORKDIR /usr/src/keycard_shell
913# set environment variables
@@ -30,11 +34,15 @@ RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/keycard_shell/wheels
3034# pull official base image
3135FROM python:3.13.2-alpine
3236
37+ # Build args for UID/GID
38+ ARG UID=1000
39+ ARG GID=1000
40+
3341# create directory for the app user
3442RUN mkdir -p /home/keycard_shell
3543
3644# create the app user
37- RUN addgroup -S keycard_shell && adduser -S keycard_shell -G keycard_shell
45+ RUN addgroup -g ${GID} - S keycard_shell && adduser -u ${UID} -S keycard_shell -G keycard_shell
3846
3947# create the appropriate directories
4048ENV HOME=/home/keycard_shell
@@ -61,16 +69,16 @@ COPY . $APP_HOME
6169RUN sed -i 's/\r//g' $APP_HOME/entrypoint.prod.sh
6270RUN chmod +x $APP_HOME/entrypoint.prod.sh
6371
64- # chown all the files to the app user
65- RUN chown -R keycard_shell:keycard_shell $APP_HOME
66- RUN mkdir -p /var/lib/keycard_shell/data
67- RUN chown -R keycard_shell:keycard_shell /var/lib/keycard_shell/data
68-
6972# build JS, CSS
7073RUN npm install
7174RUN npm run build
7275RUN npm cache clean --force
7376
77+ # chown all the files to the app user
78+ RUN chown -R ${UID}:${GID} $APP_HOME
79+ RUN mkdir -p /var/lib/keycard_shell/data
80+ RUN chown -R ${UID}:${GID} /var/lib/keycard_shell/data
81+
7482# change to the app user
7583USER keycard_shell
7684
0 commit comments