-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Files to ignore from the build context | ||
.github/ | ||
.vscode/ | ||
|
||
.git/ | ||
.gitignore | ||
.prettier* | ||
README.md | ||
|
||
# No generated artifacts | ||
dist/ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
################################################################################################################### | ||
### STAGE 0: Install Dependencies ### | ||
FROM node:20.9.0-bullseye@sha256:33e271b0c446d289f329aedafc7f57c41b3be1429956a7d1e174cfce10993eda AS dependencies | ||
WORKDIR /app | ||
|
||
# Copy package files | ||
COPY package.json package-lock.json ./ | ||
|
||
# Clean install node dependencies defined in package-lock.json excluding dev dependencies | ||
RUN npm ci --legacy-peer-deps | ||
|
||
################################################################################################################### | ||
|
||
### STAGE 1: Build ### | ||
FROM node:20.9.0-bullseye@sha256:33e271b0c446d289f329aedafc7f57c41b3be1429956a7d1e174cfce10993eda AS build | ||
|
||
WORKDIR /app | ||
|
||
# Copy the generated dependenices | ||
COPY --from=dependencies /app /app | ||
|
||
# Copy source code | ||
COPY . . | ||
|
||
# Build the application | ||
RUN ["npm", "run", "build"] | ||
|
||
################################################################################################################### | ||
|
||
### STAGE 2: Deploy ### | ||
FROM nginx:1.24.0-alpine@sha256:62cabd934cbeae6195e986831e4f745ee1646c1738dbd609b1368d38c10c5519 as deploy | ||
|
||
# Project Metadata | ||
LABEL maintainer="Amnish Singh Arora <[email protected]>"\ | ||
description="Dine-A-Night restaurant table reservation web application." | ||
|
||
# COPY nginx.conf /etc/nginx/nginx.conf | ||
COPY --from=build /app/dist/dine-a-night-ui /usr/share/nginx/html | ||
|
||
# Nginx uses the port 80 | ||
EXPOSE 80 | ||
|
||
# Add a healthcheck layer | ||
HEALTHCHECK --interval=10s --timeout=10s --start-period=10s --retries=3 \ | ||
CMD curl --fail localhost:80 || exit 1 | ||
|
||
################################################################################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# docker-compose.yml | ||
|
||
services: | ||
# Dine-A-Night Web Application UI | ||
dine-a-night: | ||
container_name: dine-a-night | ||
# Use a proper init process (tini) | ||
init: true | ||
# Build the Docker Image using the Dockerfile | ||
# and current directory as the build context | ||
build: . | ||
|
||
# Ports to publish | ||
ports: | ||
- "4200:80" |