commit 085359df8b9adc39d0a6e710c8e732c6f8a514b9 Author: Quildra Date: Mon Dec 30 19:21:03 2024 +0000 add initial files diff --git a/dockerfile.backend b/dockerfile.backend new file mode 100644 index 0000000..2a5d7c9 --- /dev/null +++ b/dockerfile.backend @@ -0,0 +1,18 @@ +FROM node:18-alpine +RUN apk add --no-cache git + +# Clone the public backend repo into /app +RUN git clone https://sinistea.pkmn.cloud/Quildra/OriginDex-API.git /app + +WORKDIR /app + +# Install dependencies +RUN npm install + +RUN npm run build + +# Expose port 5000 +EXPOSE 5000 + +# Start your Express API (assuming app.js is your entry file) +CMD ["npm", "run", "start"] diff --git a/dockerfile.frontend b/dockerfile.frontend new file mode 100644 index 0000000..27c0b5b --- /dev/null +++ b/dockerfile.frontend @@ -0,0 +1,38 @@ +# +# Stage 1: Clone and build the Angular app +# +FROM node:18-alpine AS build +RUN apk add --no-cache git + +# Introduce a "cache bust" ARG +ARG CACHEBUST=7 + +# Some command you always want to re-run +RUN echo "This step should be re-run every time: $CACHEBUST" + +# Clone the public frontend repo into /app +RUN git clone https://sinistea.pkmn.cloud/Quildra/OriginDex-FrontEnd.git /app + +WORKDIR /app + +# Install dependencies +RUN npm install + +# Build the Angular app in production mode +# If you're on Angular 14+, you might need: npm run build --configuration production +RUN npm run build_prod + +# +# Stage 2: Serve the built Angular app with Nginx +# +FROM nginx:alpine + +# Copy the Angular build output into Nginx's html folder +# Adjust the dist folder name if your Angular project is named differently +COPY --from=build /app/dist/origin-dex/browser /usr/share/nginx/html + +# Expose port 80 inside the container +EXPOSE 80 + +# Run Nginx in the foreground +CMD ["nginx", "-g", "daemon off;"] diff --git a/origindex-docker-compse.yml b/origindex-docker-compse.yml new file mode 100644 index 0000000..5e3a978 --- /dev/null +++ b/origindex-docker-compse.yml @@ -0,0 +1,22 @@ +version: "3.8" + +services: + frontend: + build: + context: . + dockerfile: fockerfile.frontend + container_name: origindex-frontend + # The Angular container runs Nginx on port 80 internally. + # If you want to access it directly (bypassing Traefik), map it to, say, 8080: + ports: + - "493:80" + + backend: + build: + context: . + dockerfile: Dockerfile.backend + container_name: origindex-backend + # The Express container listens on port 3000 internally. + # Map it to 3000 on the host if you want direct access (bypassing Traefik). + ports: + - "151:5000"