added docker file

This commit is contained in:
JBB0807 2025-04-28 09:53:22 -07:00
parent 8c5fe4266f
commit a94f4df283
17 changed files with 931 additions and 9 deletions

View file

@ -1,5 +1,5 @@
# Node.js specific
node_modules/
**node_modules/
npm-debug.log
yarn-debug.log

View file

@ -2,9 +2,10 @@ GOOGLE_CLIENT_ID = "485880105639-1in8tvb6ondnn198rasuj2d8ank06ntp.apps.googleuse
GOOGLE_CLIENT_SECRET = "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"
GOOGLE_CALLBACK_URL = "https://byte-camp-auth-service.fly.dev/auth/google/callback"
LOGIN_REDIRECT_URL = "https://bytecamp-web.fly.dev/"
ACCEPTED_ORIGINS ="https://bytecamp-web.fly.dev,https://byte-camp-auth-service.fly.dev"
#DB_USER_SERVICE_URL = "http://localhost:3000/"
DB_USER_SERVICE_URL = "http://db-user-service.internal:3000/"
AUTH_SESSION_KEY = "f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42"
fly secrets set GOOGLE_CALLBACK_URL=https://byte-camp-auth-service.fly.dev/auth/google/callback
# fly secrets set GOOGLE_CALLBACK_URL=https://byte-camp-auth-service.fly.dev/auth/google/callback
#fly secrets set GOOGLE_CLIENT_ID=485880105639-1in8tvb6ondnn198rasuj2d8ank06ntp.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 LOGIN_REDIRECT_URL=https://bytecamp-web.fly.dev/ DB_USER_SERVICE_URL=https://db-user-service.fly.dev:3000/ AUTH_SESSION_KEY=f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42

View file

@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1
# Use the official Node.js image as the base image
ARG NODE_VERSION=22.13.1
FROM node:${NODE_VERSION}-slim AS base
# Set the working directory
WORKDIR /app
COPY . .
RUN npm install
# Install dependencies using npm ci for deterministic builds
# RUN --mount=type=cache,target=/root/.npm npm ci --production
# Expose the application port
EXPOSE 8080
# Define the command to run the application
CMD ["node", "server.js"]

8
auth-service/dev.env Normal file
View file

@ -0,0 +1,8 @@
GOOGLE_CLIENT_ID="485880105639-1in8tvb6ondnn198rasuj2d8ank06ntp.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="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"
GOOGLE_CALLBACK_URL="http://localhost:8080/auth/google/callback"
LOGIN_REDIRECT_URL="http://localhost:5173/"
ACCEPTED_ORIGINS=http://localhost:3000,http://localhost:8081,http://localhost:3001,http://localhost:5137
DB_USER_SERVICE_URL="http://js-user-db-service:3100/"
AUTH_SESSION_KEY="f3f4d8e6b17a4b3abdc8e9a2c0457aaf91c0d5f6e3b7a9c8df624bd71ea35f42"
PORT=8080

View file

@ -23,13 +23,13 @@ app.use(
app.use(passport.initialize());
app.use(passport.session());
app.use(
cors({
origin: "https://bytecamp-web.fly.dev",
methods: "GET",
credentials: true,
})
)
// app.use(
// cors({
// origin: process.env.ACCEPTED_ORIGINS.split(","),
// methods: "GET",
// credentials: true,
// })
// )
app.use("/auth", authRoute);