Skip to content

Commit

Permalink
further improvements to build system
Browse files Browse the repository at this point in the history
  • Loading branch information
Highfire1 committed Apr 18, 2024
1 parent 2c6f49e commit a86c15c
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 104 deletions.
7 changes: 3 additions & 4 deletions frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules
.next

.dockerignore
**/node_modules
**/.next
**/dist
16 changes: 11 additions & 5 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
FROM node:lts-bookworm-slim
# Build step to leave behind any building artifacts / etc
FROM node:21-alpine AS build
USER node
WORKDIR /home/src/app
WORKDIR /app

# 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 yarn.lock package.json ./
RUN yarn install --production --immutable --immutable-cache --check-cache && yarn cache clean

# Minimal image for the final docker container
FROM node:lts-bookworm-slim AS prod
WORKDIR /home/src/app

COPY --from=builder --chown=node /app/node_modules ./node_modules
COPY . .

RUN yarn build

# TODO: currently, we're committing secrets to the built image as it is neccessary for the API
Expand Down
4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@
},
"devDependencies": {
"@types/react": "^18.2.64"
}
},
"main": "index.js",
"license": "MIT"
}
Loading

0 comments on commit a86c15c

Please sign in to comment.