From a52036c94a45d61e50632512791814dc6fd648b7 Mon Sep 17 00:00:00 2001 From: Anderson T Date: Wed, 17 Apr 2024 23:10:06 -0700 Subject: [PATCH] repush dockerfile improvements --- frontend/.dockerignore | 4 ++++ frontend/Dockerfile | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 frontend/.dockerignore diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..1faf9be --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.next + +.dockerignore \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index eaa6a05..400ba97 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,17 +1,22 @@ -FROM node:21 -WORKDIR /usr/src/app +FROM node:lts-bookworm-slim +USER node +WORKDIR /home/src/app -COPY . ./ +# Due to Docker's caching system this makes rebuilding the docker image much faster +COPY package.json package.json +COPY package-lock.json package-lock.json +RUN yarn install --production --immutable --immutable-cache && yarn cache clean +COPY . . +RUN yarn build + +# TODO: currently, we're committing secrets to the built image as it is neccessary for the API +# this should not be done and instead the secrets should be injected into the running image ARG APIURL ARG APIKEY ENV APIURL=${APIURL} ENV APIKEY=${APIKEY} -# building the app -RUN yarn install -RUN yarn run build - # Running the app CMD [ "yarn", "start" ]