-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from davidhfrankelcodes/dockerized
Dockerize
- Loading branch information
Showing
3 changed files
with
76 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,31 @@ | ||
# Use an official Node.js runtime as a parent image | ||
FROM node:20 | ||
|
||
# Set the working directory in the container | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json to the working directory | ||
COPY package*.json ./ | ||
|
||
# Install the app dependencies | ||
RUN npm ci | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Build the application | ||
RUN npm run build | ||
|
||
# The build output is typically placed in the 'dist' directory | ||
# Use a lightweight web server to serve the static files | ||
# We’ll use NGINX for serving our static files | ||
FROM nginx:alpine | ||
|
||
# Copy the built files from the previous build stage to the NGINX directory | ||
COPY --from=0 /app/dist /usr/share/nginx/html | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
||
# Start NGINX server | ||
CMD ["nginx", "-g", "daemon off;"] |
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
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 @@ | ||
services: | ||
localgen-ui: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
container_name: localgen-ui | ||
ports: | ||
- "${HOST_PORT:-8080}:80" # Maps port 80 in the container to port 8080 on the host | ||
# Optional: You can add environment variables or volume mappings if needed | ||
environment: | ||
NODE_ENV: ${NODE_ENV:-production} # Set the environment to production | ||
restart: unless-stopped # Restart policy for the container |