From 9c86bffcd285ea53f1b13df382f4f899184684e5 Mon Sep 17 00:00:00 2001 From: Jake Runyan Date: Fri, 27 Dec 2024 13:31:41 -1000 Subject: [PATCH] OOps here are the files --- Dockerfile | 29 +++++++++++++++++++++++++++++ docker-compose.yml | 20 ++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..abfff3e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# Use the official Node.js image as a build stage +FROM node:14 AS build + +# Set the working directory +WORKDIR /app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Copy the rest of the application code +COPY . . + +# Build the React application +RUN npm run build + +# Use a lightweight web server to serve the build files +FROM nginx:alpine + +# Copy the build files from the previous stage +COPY --from=build /app/build /usr/share/nginx/html + +# Expose port 80 +EXPOSE 80 + +# Start Nginx +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a9d954a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '2.4' + +networks: + traefik: + external: true + +services: + image: jakesphotos:latest + portfolio: + build: + context: . + dockerfile: Dockerfile + networks: + - traefik + labels: + - traefik.http.routers.photography.rule=Host(`jakesphotos.whitney.rip`) + - traefik.http.routers.photography.tls=true + - traefik.http.routers.photography.tls.certresolver=lets-encrypt + - traefik.http.services.photography.loadbalancer.server.port=80 + - traefik.port=80