Skip to content

Commit

Permalink
docker size should be 1/4 smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaprar committed Jun 30, 2024
1 parent 5b4bad4 commit 914bf3c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
IMAGE_NAME: localgems
jobs:
push:
runs-on: macos-latest
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
Expand Down
25 changes: 17 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
FROM node:20 as frontend-builder

WORKDIR /home/app

RUN yarn config set network-timeout 300000

COPY ./frontend/package.json ./frontend/yarn.lock /home/app/frontend/

WORKDIR /home/app/frontend
RUN NODE_ENV=production yarn install

COPY ./frontend /home/app/frontend/
RUN yarn build


FROM node:20

WORKDIR /home/app
Expand All @@ -7,21 +22,15 @@ RUN yarn config set network-timeout 300000
RUN yarn global add concurrently

COPY ./backend/package.json ./backend/yarn.lock /home/app/backend/
COPY ./frontend/package.json ./frontend/yarn.lock /home/app/frontend/

WORKDIR /home/app/backend
RUN yarn install

WORKDIR /home/app/frontend
RUN yarn install
RUN NODE_ENV=production yarn install

WORKDIR /home/app/backend
COPY ./backend /home/app/backend/
RUN NODE_ENV=production yarn build

WORKDIR /home/app/frontend
COPY ./frontend /home/app/frontend/
RUN yarn build
COPY --from=frontend-builder /home/app/frontend/.output/server /home/app/frontend/.output/server

COPY ./entrypoint.sh /home/app/entrypoint.sh

Expand Down

0 comments on commit 914bf3c

Please sign in to comment.