Skip to content

Commit

Permalink
Merge pull request #15 from tonitienda/feat/webapp-react-docker
Browse files Browse the repository at this point in the history
feat: adds dockerfile to build the react based webapp
  • Loading branch information
tonitienda authored Mar 21, 2024
2 parents 5b12fc6 + 216c19f commit 11ae128
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
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"]

0 comments on commit 11ae128

Please sign in to comment.