Sign inSign up

derogab/dockerized-app

By derogab

•Updated almost 5 years ago

Dockerized App: a college project at unimib. See github.com/derogab/dockerized-app

Image
0

426

derogab/dockerized-app repository overview

⁠dockerized-app

⁠Dockerized App: CLOUD COMPUTING⁠ college project at unimib⁠.

⁠Assignment

  1. Code a service backed by a database e.g., CRUD operations against a table/document
    • The programming language is at your choice
    • You can reuse a code that you have at your disposal
    • The service can be very simple if you like
  2. Create a (multi-stage) dockerfile for the service and build a small image for the service
    • As for the database, you can use an image for the Docker hub repository
  3. Create a docker-compose file with
    • A managed volume or a bind mount volume for the database
    • A virtual network
    • A suitable restart policy for the service
    • Resource limitation (select some amount of cpu and ram)
  4. Deploy on the remote and check the application works correctly
  5. Write a readme.txt file with the commands (to compile and deploy)
  6. Submit a zip archive with project files, readme, dockerfile, docker-compose.yml
    • You will find on the elearning the widget to submit your work

⁠Execute

docker-compose --compatibility up
Click here to view the Compose File
version: '3'

services:

  db:
    restart: always
    container_name: dockerized-db
    image: postgres:14.1-alpine
    environment:
      POSTGRES_PASSWORD: 123456789
    volumes:
       - dockerized-local-db:/var/lib/postgresql/data 
    networks:
      - dockerized-local-network
    deploy:
      restart_policy:
        condition: on-failure

  app:
    restart: always
    container_name: dockerized-app
    image: derogab/dockerized-app:latest
    build:
      context: .
    ports:
      - '8080:8080'
    depends_on:
      - db
    links:
      - db
    environment:
      PGHOST: db
      PGUSER: postgres
      PGPASSWORD: 123456789
      PGDATABASE: postgres
      PGPORT: 5432
    deploy:
      resources:
        limits:
          cpus: '0.3'
          memory: '512M'
      restart_policy:
        condition: on-failure
      
    networks:
      - dockerized-local-network

  adminer:
    restart: always
    container_name: dockerized-db-viewer
    image: adminer:4.8.1
    depends_on:
      - db
    links:
      - db
    ports:
      - 8081:8080
    networks:
      - dockerized-local-network
    deploy:
      resources:
        limits:
          cpus: '0.5'
          memory: '1G'
      restart_policy:
        condition: on-failure


volumes:
  dockerized-local-db:
    driver: local


networks:
  dockerized-local-network:
    driver: bridge

⁠Credits

Tag summary

Content type

Image

Digest

Size

44.1 MB

Last updated

almost 5 years ago

docker pull derogab/dockerized-app