Skip to content
Snippets Groups Projects
Verified Commit d31d9163 authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Preparing to production

parent a9377919
Branches
No related tags found
No related merge requests found
Pipeline #8746 failed
**
!measurer
!run.sh
docker-compose.yaml
stages:
- build
image: docker:20.10.8
image: docker:20.10.9
variables:
DOCKER_TLS_CERTDIR: "/certs"
IMAGE_TAG_APP: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
IMAGE_TAG_NGINX: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-nginx
services:
- docker:20.10.8-dind
- docker:20.10.9-dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build_app:
stage: build
script:
- docker pull $CI_REGISTRY_IMAGE:master || true
- docker build --cache-from $CI_REGISTRY_IMAGE:master -t $IMAGE_TAG_APP .
- docker push $IMAGE_TAG_APP
build_nginx:
build:
stage: build
when: manual
script:
- docker pull $CI_REGISTRY_IMAGE:test-nginx || true
- docker build --cache-from $CI_REGISTRY_IMAGE:test-nginx -t $IMAGE_TAG_NGINX . -f Dockerfile.nginx
- docker push $IMAGE_TAG_NGINX
- VERSION=`cat VERSION`
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$VERSION --tag $CI_REGISTRY_IMAGE:latest .
- docker push $CI_REGISTRY_IMAGE:$VERSION
- docker push $CI_REGISTRY_IMAGE:latest
......@@ -27,10 +27,6 @@ RUN PIPENV_VENV_IN_PROJECT=1 pipenv install gunicorn
FROM base AS runtime
# Install Postgres
RUN apt-get update
RUN apt-get install -yq --no-install-recommends postgresql
# Copy virtual env from python-deps stage
COPY --from=python-deps /.venv /.venv
ENV PATH="/.venv/bin:$PATH"
......
FROM nginx:1.23
EXPOSE 8080
ADD nginx.conf /etc/nginx/conf.d/measurer.conf
0.1.0
version: "3"
services:
database:
image: "postgres:latest"
environment:
POSTGRES_DB: measurer
POSTGRES_PASSWORD: measurer
POSTGRES_USER: measurer
expose:
- "5432"
restart: always
measurer:
build: "."
image: ppm
environment:
FLASK_APP: measurer
FLASK_ENV: production
DATABASE_URL: postgresql://measurer:measurer@database/measurer
depends_on:
- database
DATABASE_URL: postgresql://ppm:password@10.42.0.11/ppm
ports:
- "5009:5009"
restart: always
- "8080:5009"
volumes:
- "./config.example.json:/home/appuser/config.json"
command: ["/bin/bash", "./run.sh"]
upstream measurer {
ip_hash;
server measurer:5009
}
server {
server_name measurer;
listen 8080;
client_max_body_size 10M;
proxy_connect_timeout 60;
proxy_send_timeout 60;
proxy_read_timeout 60;
send_timeout 60;
location / {
proxy_pass http://measurer/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment