Skip to content

Commit

Permalink
change: dockerfile multistage build
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoslat1 committed May 30, 2024
1 parent dda5083 commit f240577
Show file tree
Hide file tree
Showing 44 changed files with 95 additions and 404 deletions.
6 changes: 5 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
node_modules
dev-dist
dist
node_modules
.github
push.sh
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Nama workflow
name: Excel Reader App CI/CD

on:
push:
branches:
- main

pull_request:
branches:
- main

jobs:
build:
name: Build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

deploy:
name: Deploy DockerHub
needs: build
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
env:
DOCKER_IMAGE: ${{ secrets.DOCKER_USERNAME }}/vitets-excel-reader
run: |
docker build -t $DOCKER_IMAGE .
docker push $DOCKER_IMAGE
32 changes: 17 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM node:18-alpine

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

RUN npm run build

EXPOSE 8080

CMD [ "npm", "run", "preview" ]
# ---- Build Stage ----
FROM node:latest AS build
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
RUN npm run build

# ---- Runtime Stage ----
FROM node:22-alpine
WORKDIR /app
# Install serve globally
RUN npm install -g serve
COPY --from=build /app/dist /app/dist

EXPOSE 8080
CMD ["serve", "-s", "dist", "-l", "8080"]
2 changes: 0 additions & 2 deletions dist/assets/@babel-BnI1kD_8.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/@radix-ui-DUekbd2x.js

This file was deleted.

22 changes: 0 additions & 22 deletions dist/assets/@tanstack-Bonzvd9E.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/aria-hidden-TUpxsc0i.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/class-variance-authority-Bb4qSo10.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/clsx-B-dksMZM.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/d3-array-AEr2eHiX.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/d3-color-Dk6-D7ez.js

This file was deleted.

Loading

0 comments on commit f240577

Please sign in to comment.