diff --git a/deploy/docker-compose.prod.yml b/deploy/docker-compose.prod.yml new file mode 100644 index 0000000..9b6be6c --- /dev/null +++ b/deploy/docker-compose.prod.yml @@ -0,0 +1,54 @@ +version: '3.8' + +services: + backend: + build: + context: ../backend/ + dockerfile: ../deploy/dev/Dockerfile.backend + volumes: + - ../backend:/code + expose: + - 8000 + command: bash -c "python configure.py; python configure.py testdata; python manage.py runserver 0.0.0.0:8000 --insecure" + + frontend: + build: + context: ../frontend/ + dockerfile: ../deploy/dev/Dockerfile.frontend + volumes: + - ../frontend:/app + expose: + - 5173 + command: npm run dev -- --host + + wiki: + build: + context: ../ + dockerfile: deploy/dev/Dockerfile.wiki + volumes: + - ../mkdocs.yml:/wiki/mkdocs.yml + - ../docs:/wiki/docs + expose: + - 8001 + command: mkdocs serve --dev-addr=0.0.0.0:8001 + + nginx: + image: nginx:latest + volumes: + - ./dev/fullchain.pem2:/etc/nginx/nginx.crt + - ./dev/privkey.pem2:/etc/nginx/nginx.key + - ./dev/nginx-instance_a.dev.conf:/etc/nginx/nginx.conf + - ./dev/dns.json:/var/www/dns.json + - ./dev/domains.json:/var/www/domains.json + ports: + - 8080:8080 + - 5353:5353 + + dns: + build: + context: ./dev/ + dockerfile: Dockerfile.dns + volumes: + - ./dev/zone.json:/dns/zone.json + expose: + - 8053 \ No newline at end of file diff --git a/deploy/prod/Dockerfile.frontend b/deploy/prod/Dockerfile.frontend new file mode 100644 index 0000000..10a2cc3 --- /dev/null +++ b/deploy/prod/Dockerfile.frontend @@ -0,0 +1,15 @@ +# Use an official Node.js runtime as instance_a parent image +FROM node:14 + +# Set work directory +WORKDIR /app + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied +COPY package.json ./ + +RUN npm install +# If you are building your code for production +# RUN npm ci --only=production + +CMD [ "npm", "run", "dev", "--", "--host"] diff --git a/deploy/prod/Dockerfile.frontend.prod b/deploy/prod/Dockerfile.frontend.prod new file mode 100644 index 0000000..7b3947e --- /dev/null +++ b/deploy/prod/Dockerfile.frontend.prod @@ -0,0 +1,14 @@ +ROM node:alpine as builder +WORKDIR /app +COPY ./package.json /app/package.json +COPY . /app +RUN npm ci --only=production +RUN npm run build + + +FROM nginx:alpine as runner +#RUN apk add --update npm +WORKDIR /app +COPY --from=builder /app/dist /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/nginx.conf +EXPOSE 80