Browse Source

add initial files

master
Quildra 12 months ago
commit
085359df8b
  1. 18
      dockerfile.backend
  2. 38
      dockerfile.frontend
  3. 22
      origindex-docker-compse.yml

18
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"]

38
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;"]

22
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"
Loading…
Cancel
Save