Skip to content

Commit

Permalink
Update dockerfile and build dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
LachlanCourt committed Apr 21, 2024
1 parent 9dcc748 commit c450ed9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
!tsconfig.json
!vite.config.ts
!yarn.lock
!.yarnrc.yml
!.yarn
14 changes: 9 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM node:18-alpine3.17 as base
ARG NODE_IMAGE_NAME=20-alpine3.18

FROM node:${NODE_IMAGE_NAME} as base

COPY . ./code
WORKDIR /code
Expand All @@ -10,23 +12,25 @@ RUN yarn build
# Set up database
RUN yarn prisma generate

FROM node:18-alpine3.17 as module-installation
FROM node:${NODE_IMAGE_NAME} as module-installation

COPY package.json ./code/package.json
COPY yarn.lock ./code/yarn.lock
COPY .yarnrc.yml ./code/.yarnrc.yml
COPY .yarn ./code/.yarn
WORKDIR /code

# Install production dependencies
RUN apk add --no-cache jq
RUN apk add --no-cache jq
RUN jq 'del(.devDependencies)' package.json > package.json.temp && mv package.json.temp package.json
RUN yarn install --production --no-optional
RUN yarn install

# Copy database client data
COPY --from=base ./code/node_modules/@prisma ./node_modules/@prisma
COPY --from=base ./code/node_modules/.prisma ./node_modules/.prisma
COPY --from=base ./code/node_modules/prisma ./node_modules/prisma

FROM node:18-alpine3.17 as final
FROM node:${NODE_IMAGE_NAME} as final

RUN apk add curl

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fetch-dev-db:
docker pull postgres && docker tag postgres dev-db:latest
docker pull postgres:15 && docker tag postgres:15 dev-db:latest
start-dev-db:
docker run --name dev-db -e POSTGRES_PASSWORD=password --hostname docker --network qwik-network -d -v $(shell pwd)/database:/var/lib/postgresql/data dev-db
remove-dev-db:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"@types/express": "4.17.17",
"@types/node": "^18.11.16",
"@types/node-fetch": "latest",
"@typescript-eslint/eslint-plugin": "7.7.0",
"@typescript-eslint/parser": "7.7.0",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"compression": "^1.7.4",
"eslint": "8.30.0",
"eslint-plugin-qwik": "0.16.1",
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5995,7 +5995,7 @@ __metadata:
languageName: node
linkType: hard

"sharp@npm:^0.33.1":
"sharp@npm:^0.33.1, sharp@npm:^0.33.3":
version: 0.33.3
resolution: "sharp@npm:0.33.3"
dependencies:
Expand Down Expand Up @@ -6828,6 +6828,7 @@ __metadata:
prettier: "npm:2.8.1"
preview-email: "npm:^3.0.7"
prisma: "npm:^4.15.0"
sharp: "npm:^0.33.3"
typescript: "npm:5.4.5"
undici: "npm:5.19.1"
util: "npm:^0.12.5"
Expand Down

0 comments on commit c450ed9

Please sign in to comment.