Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi-stage build #57

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
node_modules
build
/.github/
.gitignore
.idea/
/doc/
Dockerfile
node_modules
/test-results/
/tests/
/playwright-report/
/blob-report/
/playwright/.cache/
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ dist
# TernJS port file
.tern-port

build/
.idea/
.sass-cache
src/App.css
src/App.css.map
/test-results/
/playwright-report/
/blob-report/
Expand Down
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
FROM node:22
FROM node:22 AS builder

WORKDIR /app
COPY package.json yarn.lock ./

ARG TESTING_E2E
ENV VITE_TESTING_E2E=${TESTING_E2E}

WORKDIR /opt/ezshare/
COPY package.json .
RUN yarn
RUN yarn install --frozen-lockfile
COPY . .

RUN yarn build

FROM node:22-slim AS runtime

RUN useradd --user-group --create-home --shell /bin/false appuser \
&& mkdir -p /app/dist \
&& chown -R appuser:appuser /app \
&& yarn global add serve@^14.0.1

WORKDIR /app

COPY --from=builder /app/dist ./dist
USER appuser
EXPOSE 3000

CMD ["yarn", "serve", "-s", "dist/"]
CMD ["serve", "-s", "dist/"]
Loading