Commit ff2f8a4b by Chif Gergő

Create different builds for production

parent 2e73a13c
Pipeline #1156 failed with stage
in 1 minute 52 seconds
......@@ -13,7 +13,10 @@ ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
RUN pipenv install -d
# Copy sources
COPY ./recircle ./recircle
# Set working dir where the manage.py found
WORKDIR /usr/cloud/portal/recircle
# Migrate and start server
CMD pipenv run python recircle/manage.py migrate \
&& pipenv run python recircle/manage.py runserver 0.0.0.0:8000
CMD pipenv run python manage.py migrate \
&& pipenv run python manage.py runserver 0.0.0.0:8000 \
&& pipenv run celery -A recircle worker -B
FROM python:3.6
WORKDIR /usr/cloud/portal
SHELL ["/bin/bash", "-c"]
# Install pipenv
RUN pip install pipenv
# Open 8000 port
EXPOSE 8000/tcp
# Copy files necessary for install dependencies
COPY Pipfile* .env ./
# This env variable needed to pipenv find .env file
ENV PIPENV_DOTENV_LOCATION=/usr/cloud/portal/.env
# Install dependencies
RUN pipenv install -d
# Copy sources
COPY ./recircle ./recircle
# Set working dir where the manage.py found
WORKDIR /usr/cloud/portal/recircle
# Migrate and start server
CMD pipenv run python manage.py migrate \
&& pipenv run python manage.py collectstatic --no-input --clear \
&& pipenv run gunicorn recircle.wsgi:application --bind 0.0.0.0:8000
FROM nginx:1.19-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY ./recircle.conf /etc/nginx/conf.d
\ No newline at end of file
upstream recircle {
server backend:8000;
}
server {
listen 80;
location /admin {
proxy_pass http://recircle;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /api/v1/ {
proxy_pass http://recircle;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
location /static/ {
alias /static/;
}
}
\ No newline at end of file
version: "3.8"
services:
nginx:
build: ./config/nginx
image: recircle-nginx
ports:
- "80:80"
volumes:
- "/static:/static"
networks:
- backend
depends_on:
- backend
backend:
build:
context: .
dockerfile: ./Dockerfile.prod
image: portal:compose
networks:
- backend
expose:
- "8000"
volumes:
- "/static:/static"
depends_on:
- db
- redis
db:
image: postgres:13-alpine
environment:
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_DB: ${DATABASE_NAME}
networks:
- backend
redis:
image: redis:alpine
ports:
- "6379"
networks:
- backend
networks:
backend:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment