51 lines
1.6 KiB
Docker
51 lines
1.6 KiB
Docker
FROM ubuntu:noble
|
|
|
|
RUN apt-get -q update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
|
ca-certificates curl gnupg \
|
|
curl \
|
|
nano \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
|
|
RUN mkdir -p /etc/apt/keyrings
|
|
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
|
|
|
ENV NODE_MAJOR=22
|
|
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
|
|
|
|
RUN apt-get -q update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
|
nodejs \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
|
|
|
|
RUN apt-get -q update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
|
|
sqlite3 \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
|
|
|
|
COPY server /server
|
|
WORKDIR /server
|
|
RUN npm install -s sqlite3
|
|
RUN npm install
|
|
RUN npm run build
|
|
|
|
# prepare client deps in the image so lint/type-check can run inside the container
|
|
# copy client sources and install dependencies during the image build (container-first)
|
|
COPY client /client
|
|
WORKDIR /client
|
|
ENV PUBLIC_URL="/ketr.ketran"
|
|
ENV REACT_APP_API_BASE=""
|
|
# prefer npm ci when lockfile present, otherwise fall back to npm install
|
|
RUN rm -f package-lock.json
|
|
RUN npm install --legacy-peer-deps --no-audit --no-fund
|
|
RUN npm run build
|
|
# return to server working dir for default run
|
|
WORKDIR /server
|
|
|
|
COPY /Dockerfile /Dockerfile
|
|
COPY /.env /.env
|
|
|
|
CMD ["npm", "start"]
|