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: adds dockerfile to build the react based webapp #15

Merged
merged 1 commit into from
Mar 21, 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
4 changes: 3 additions & 1 deletion .github/workflows/build-run-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image
- name: Build Golang Rest Backend Docker image
run: docker build -t backend-golang-rest backend-golang-rest
- name: Build React WebApp Docker image
run: docker build -t webapp-react webapp-react
24 changes: 24 additions & 0 deletions webapp-react/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Stage 1: Build the application
FROM node:18-alpine AS build

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm install --frozen-lockfile

COPY . .
RUN npm run build

# Stage 2: Create the production image
FROM node:18-alpine

WORKDIR /app

COPY --from=build /app/package.json /app/package-lock.json ./
RUN npm install --production --frozen-lockfile

COPY --from=build /app/.next ./.next

EXPOSE 3000

CMD ["npm", "start"]
Loading