Skip to content

Commit

Permalink
Merge branch 'development' of github.com:kieler/RailTrail into develo…
Browse files Browse the repository at this point in the history
…pment
  • Loading branch information
NicoBiernat committed Sep 13, 2023
2 parents 7cd8469 + 02a1631 commit 300d4e5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 14 deletions.
26 changes: 19 additions & 7 deletions Server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine
FROM node:18-alpine AS build-stage

WORKDIR /app

Expand All @@ -9,13 +9,25 @@ COPY package*.json ./
RUN npm i -g node-gyp
RUN npm i

# TODO: currently we need dev-dependancies (like typescript) installed for our product to work
# These are not installed when NODE_ENV=production, so we set that ENV later
ENV NODE_ENV production
# Copy remaining parts
COPY . .

RUN chmod +x ./startup.sh
# Generate prisma files
RUN npx prisma generate

# Build the TypeScript application
RUN npm run build

# Run the service
ENTRYPOINT [ "./startup.sh" ]
FROM node:18-alpine AS base

WORKDIR /app

# Copy only the built files from the previous stage
COPY --from=build-stage /app/build ./build
COPY --from=build-stage /app/package.json ./
COPY --from=build-stage /app/prisma/schema.prisma ./
COPY --from=build-stage /app/node_modules ./node_modules

FROM base AS production-stage
ENV NODE_ENV production
CMD ["npm", "start"]
17 changes: 15 additions & 2 deletions Server/docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,27 @@ services:
networks:
- railtrail

#railtrail-backend:
# build: ./
# restart: unless-stopped
# depends_on:
# - postgres
# ports:
# - "8080:8080"
# environment:
# - DATABASE_URL=postgresql://${POSTGRES_USER}:${POSTGRES_PWD}@postgres:5432/${POSTGRES_DB}
# - SERVER_PORT=8080
# networks:
# - railtrail

#railtrail-website:
# image: ghcr.io/kieler/railtrail-website:development
# restart: unless-stopped
# ports: # @Sascha: Je nach Reverse-Proxy Situation hier bitte den Port anpassen:
# ports:
# - "80:3000"
# environment:
# - PORT=3000
# - BACKEND_URI=https://railtrail.rtsys.informatik.uni-kiel.de:8080 # @Sascha: Je nach Reverse-Proxy Situation hier bitte die URI anpassen. Ohne Anführungsstriche o.ä.:
# - BACKEND_URI=http://railtrail-backend:8080
# networks:
# - railtrail

Expand Down
8 changes: 3 additions & 5 deletions Server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@
"description": "Backend service for the RailTrail project.",
"main": "index.ts",
"scripts": {
"start": "tsc && node ./build/index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"start": "prisma db push && node ./build/index.js",
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts",
"prisma": "prisma generate && prisma db push && ts-node prisma/seed.ts",
"tsc": "tsc",
"generate-guards": "npx ts-auto-guard ./src/models/api*.ts"
"prisma": "prisma generate && prisma db push && ts-node prisma/seed.ts"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 300d4e5

Please sign in to comment.