generated from amosproj/amos202Xss0Y-projname
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from amosproj/150-fix-start-script-for-produc…
…tion-runs 150 fix start script for production runs
- Loading branch information
Showing
12 changed files
with
188 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ services: | |
EMAIL__HOST: smtp.strato.de | ||
EMAIL__PORT: 587 | ||
EMAIL__ADDRESS: [email protected] | ||
EMAIL__PSW: 123456 | ||
EMAIL__PSW: ${EMAIL__PSW} | ||
ASPNETCORE_ENVIRONMENT: Development | ||
|
||
# Uncomment the next line to use a non-root user for all processes. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.devcontainer/.env | ||
|
||
# Node | ||
logs | ||
npm-debug.log* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
# Copy this file into a .env.local | ||
|
||
BACKEND_URL=http://localhost:3001 | ||
# Secret which is used for the jwt auth tokens in frontend | ||
NEXTAUTH_SECRET=test1234 | ||
# Must be the public url of the frontend | ||
NEXTAUTH_URL=http://localhost:3000 | ||
|
||
POSTGRES_DB=deskstar | ||
POSTGRES_USER=postgres | ||
POSTGRES_PASSWORD=root | ||
|
@@ -10,6 +18,6 @@ DB__PASSWORD=root | |
EMAIL__HOST=smtp.strato.de | ||
EMAIL__PORT=587 | ||
[email protected] | ||
EMAIL__PSW=123456 | ||
EMAIL__PSW= | ||
|
||
ASPNETCORE_ENVIRONMENT=Development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0 | ||
|
||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends \ | ||
postgresql | ||
|
||
RUN dotnet tool install --global dotnet-ef | ||
|
||
|
||
WORKDIR /Deskstar | ||
# Copy everything | ||
COPY . ./ | ||
# Restore as distinct layers | ||
RUN dotnet restore | ||
# Build and publish a release | ||
RUN dotnet publish -c Dev -o out | ||
|
||
ENV PATH="${PATH}:~/.dotnet/tools/" | ||
|
||
CMD ["dotnet", "bin/Dev/net6.0/Deskstar.dll"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,57 @@ | ||
FROM node:16.18 | ||
# Install dependencies only when needed | ||
FROM node:16-alpine AS deps | ||
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. | ||
RUN apk add --no-cache libc6-compat | ||
WORKDIR /app | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./ | ||
RUN \ | ||
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \ | ||
elif [ -f package-lock.json ]; then npm ci; \ | ||
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \ | ||
else echo "Lockfile not found." && exit 1; \ | ||
fi | ||
|
||
|
||
# Rebuild the source code only when needed | ||
FROM node:16-alpine AS builder | ||
WORKDIR /app | ||
COPY . . | ||
COPY --from=deps /app/node_modules ./node_modules | ||
|
||
# Next.js collects completely anonymous telemetry data about general usage. | ||
# Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN yarn build | ||
|
||
# If using npm comment out above and use below instead | ||
# RUN npm run build | ||
|
||
# Production image, copy all the files and run next | ||
FROM node:16-alpine AS runner | ||
WORKDIR /app | ||
|
||
COPY ./package.json . | ||
ENV NODE_ENV production | ||
# Uncomment the following line in case you want to disable telemetry during runtime. | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=builder /app/public ./public | ||
|
||
# Automatically leverage output traces to reduce image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
|
||
USER nextjs | ||
|
||
RUN ["yarn", "install"] | ||
EXPOSE 3000 | ||
|
||
ENV PATH=/app/node_modules/.bin:$PATH | ||
ENV PORT 3000 | ||
|
||
WORKDIR /app/code | ||
CMD ["node", "server.js"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
const nextConfig = { | ||
reactStrictMode: true, | ||
swcMinify: true, | ||
output: "standalone" | ||
} | ||
|
||
module.exports = nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
services: | ||
frontend: | ||
container_name: deskstar_frontend | ||
build: | ||
context: ./deskstar-frontend | ||
ports: | ||
- 3000:3000 | ||
environment: | ||
- BACKEND_URL | ||
- NEXTAUTH_SECRET | ||
- NEXTAUTH_URL | ||
networks: | ||
- external | ||
- internal | ||
backend: | ||
container_name: deskstar_backend | ||
depends_on: | ||
- "postgres" | ||
build: | ||
context: ./deskstar-backend/Deskstar | ||
ports: | ||
- 3001:80 | ||
environment: | ||
- ASPNETCORE_ENVIRONMENT | ||
- DB__HOST | ||
- DB__DATABASE | ||
- DB__USERNAME | ||
- DB__PASSWORD | ||
# defined in .env.local (will no be pushed to git) | ||
- EMAIL__HOST | ||
- EMAIL__PORT | ||
- EMAIL__ADDRESS | ||
- EMAIL__PSW | ||
networks: | ||
- internal | ||
dbpreparation: | ||
container_name: deskstar_db_prep | ||
build: | ||
context: ./deskstar-backend/Deskstar | ||
dockerfile: Dockerfile_dev | ||
depends_on: | ||
- "postgres" | ||
environment: | ||
# - ASPNETCORE_ENVIRONMENT | ||
- DB__HOST | ||
- DB__DATABASE | ||
- DB__USERNAME | ||
- DB__PASSWORD | ||
# defined in .env.local (will no be pushed to git) | ||
- EMAIL__HOST | ||
- EMAIL__PORT | ||
- EMAIL__ADDRESS | ||
- EMAIL__PSW | ||
networks: | ||
- internal | ||
command: dotnet ef database update | ||
postgres: | ||
container_name: deskstar_postgres | ||
image: postgres | ||
user: "postgres" | ||
environment: | ||
- POSTGRES_USER | ||
- POSTGRES_DB | ||
- POSTGRES_PASSWORD | ||
ports: | ||
- 5433:5432 | ||
networks: | ||
- internal | ||
volumes: | ||
exclude: | ||
networks: | ||
internal: | ||
external: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export USER_ID="$(id -u)" | ||
export GROUP_ID="$(id -g)" | ||
docker compose --env-file .env up --build | ||
export DOCKER_BUILDKIT=0 | ||
export COMPOSE_DOCKER_CLI_BUILD=0 | ||
|
||
docker compose --env-file .env.local up --build |