'Docker compose and docker container group on Azure
I got my test app written in django and splitted up few containers with docker-compose.yml file with djangoapp+postgres+gunicorn+nginx. I can see my app locally from builded containers and can add data to db throught admin panel. I'm trying to deploy this app to Azure portal with App Service and dockerhub repository but I always get 404 error. I saw that compose file on azure is experimental option witch is not supporting few commands in docker-compose.yml files. Is even possible to deploy this kind of app to Azure or on any other cloud service? Having this problem i thought about my image in repository. Should it be there just app image or maybe all images created with compose file?
docker-compose.yml
version: '3.8'
services:
web:
build: ./blogapp
container_name: web
command: gunicorn mypersonalsite.wsgi:application --bind 0.0.0.0:80
volumes:
- static_volume:/home/app/blogapp/staticfiles
- media_volume:/home/app/blogapp/mediafiles
expose:
- 80
env_file:
- .env.dev
depends_on:
- db
db:
image: postgres:13.0-alpine
container_name: postgres
volumes:
- postgres_data:/var/lib/postgresql/data/
env_file:
- .env.db
nginx:
build: ./nginx
container_name: nginx
volumes:
- static_volume:/home/app/blogapp/staticfiles
- media_volume:/home/app/blogapp/mediafiles
ports:
- 80:80
depends_on:
- web
volumes:
postgres_data:
static_volume:
media_volume:
app Dockerfile
FROM python:3.9.6-alpine
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
RUN mkdir -p /home/app
ENV HOME=/home/app
ENV APP_HOME=/home/app/blogapp
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
RUN apk update \
&& apk add --virtual build-deps gcc python3-dev musl-dev \
&& apk add postgresql \
&& apk add postgresql-dev \
&& pip install psycopg2 \
&& apk add jpeg-dev zlib-dev libjpeg \
&& pip install Pillow \
&& apk del build-deps
RUN pip3 install --upgrade pip
COPY ./requirements.txt .
RUN pip3 install -r requirements.txt
COPY . $APP_HOME
nginx Dockerfile
FROM nginx:stable-alpine
RUN rm /etc/nginx/conf.d/default.conf
COPY nginx.conf /etc/nginx/conf.d
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
