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

added Dockfile for frontend #100

Closed
wants to merge 3 commits into from
Closed
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
2 changes: 1 addition & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["next/babel", "next/core-web-vitals"]
"extends": ["next", "next/core-web-vitals"]
}
35 changes: 35 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Stage 1: Building the code
FROM node:16-alpine AS builder

WORKDIR /app

# Copy the package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production

# Copy the app source code
COPY . .

# Build the app
RUN npm run build

# Stage 2: Run the app
FROM node:16-alpine AS runner
WORKDIR /app

# Copy built assets from the builder stage
COPY --from=builder /app/.next/ .next/
COPY --from=builder /app/node_modules/ node_modules/
COPY --from=builder /app/public/ public/
COPY --from=builder /app/package.json package.json

# Expose the port Next.js runs on
EXPOSE 3000

# Set environment to production to avoid including unnecessary files
ENV NODE_ENV production

# Start the app
CMD ["npm", "start"]
134 changes: 1 addition & 133 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions frontend/src/components/NavigationBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import MenuIcon from "@mui/icons-material/Menu";
import Container from "@mui/material/Container";
import Button from "@mui/material/Button";
import MenuItem from "@mui/material/MenuItem";
import AutoMateLogo from "../../public/Automate_logo.png";
import Image from "next/image";
import Link from "next/link";

Expand All @@ -31,7 +30,12 @@ function NavigationBar() {
<Container maxWidth="xl">
<Toolbar disableGutters>
<Box sx={{ display: { xs: "none", md: "flex" }, mr: 1 }}>
<Image width={50} alt="AutoMate Logo" src={AutoMateLogo} />
<Image
width={50}
height={50}
alt="AutoMate Logo"
src="/AutoMate_logo.png"
/>
</Box>
<Typography
variant="h6"
Expand Down Expand Up @@ -94,8 +98,13 @@ function NavigationBar() {
</Menu>
</Box>

<Box sx={{ display: { xs: "flex", md: "none" }, mr: 1 }}>
<Image width={50} alt="AutoMate Logo" src={AutoMateLogo} />
<Box sx={{ display: { xs: "none", md: "flex" }, mr: 1 }}>
<Image
width={50}
height={50}
alt="AutoMate Logo"
src="/AutoMate_logo.png"
/>
</Box>
<Typography
variant="h5"
Expand Down
10 changes: 7 additions & 3 deletions frontend/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useState } from "react";
import Typography from "@mui/material/Typography";
import "@fontsource/public-sans";
import AutoMateLogo from "../../public/Automate_logo.png";
import Image from "next/image";
import Button from "@mui/material/Button";
import styled from "@emotion/styled";
Expand Down Expand Up @@ -120,8 +119,13 @@ export default function Home() {
</Button>
</Element>
</Element>
<Picture style={{ left: "10" }}>
<Image width={500} alt="AutoMate Logo" src={AutoMateLogo} />
<Picture>
<Image
width={500}
height={500}
alt="AutoMate Logo"
src="/AutoMate_logo.png"
/>
</Picture>
</BoxContainer>
</Container>
Expand Down