SLC-S23W3 - Docker & Devops - Candidate Evaluation Platform

in #techclubyesterday

image.png


Welcome to Week 3 of our Tech & Dev Club learning series. After covering project planning, UML diagrams, and methodologies last week, we're now diving into the world of containerization with Docker. This is a crucial DevOps skill that will help you build, deploy, and scale applications more efficiently.


What you'll Learn.

  • What Docker is and why it is useful
  • Basic Docker parts like images and containers
  • How to make Dockerfiles
  • How to use Docker Compose for many containers
  • Looking at real Dockerfiles from our project

What is docker?

Docker is a platform that helps developers put applications in containers. Containers are like small boxes that hold all the app needs. This makes the app work the same on all computers.


Why docker is good?

  1. No more "works on my machine" problems
  2. Apps don't mess with each other
  3. Containers are small and fast
  4. Easy to make more copies when needed
  5. Makes testing and deployment simple

Docker Architecture

image.png
Docker Architecture created using mermaid


Docker has three main parts:

  • Docker Client: where you type commands
  • Docker Host: the server that runs containers
  • Docker Registry: stores Docker images

Docker components

1. Images

Images are like blueprints for containers. They cannot change.

2. Containers

Containers are running copies of images. They have everything the app needs.

3. Volumes

Volumes save data even when containers stop.


Understanding Dockerfiles

A Dockerfile is a text file with steps to make a Docker image:

FROM node:16.5.0-alpine      # Base image
WORKDIR /app                 # Sets working directory
COPY package.json ./         # Copies files from host to image
RUN npm install              # Executes commands during build
CMD ["npm", "start"]         # Default command when container starts

Maindockerfile instructions

  • FROM: picks the base image
  • WORKDIR: sets the work folder
  • COPY/ADD: copies files into the image
  • RUN: runs commands when building
  • ENV: sets environment variables
  • EXPOSE: shows which ports to use
  • CMD/ENTRYPOINT: sets the start command

Docker Compose

Docker Compose helps run many containers together. It uses a YAML file:

version: "3"
services:
  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
    volumes:
      - ./frontend:/app
  backend:
    build: ./backend
    ports:
      - "8080:8080"
    depends_on:
      - database
  database:
    image: postgres:13
    environment:
      - POSTGRES_PASSWORD=password

Key Docker Compose Ideas

  • Services: the containers in your app
  • Volumes: storage that stays
  • Networks: how containers talk to each other
  • Dependencies: which container starts first

Our Project's Dockerfiles


image.png
my architectcture application using mermaid

Let's analyze the Dockerfiles from our project:

Frontend Dockerfile

FROM node:16.5.0-alpine

WORKDIR /app

RUN node -v
RUN apk add libc6-compat
RUN apk add openssh-client
RUN apk add git

COPY package.json ./
COPY package-lock.json ./
RUN npm i

ADD . .
RUN ls -la
RUN chmod +x env.sh
RUN npm run env
RUN cp env-config.js ./public

CMD [ "npm", "run", "start"]

What this does:

  1. Starts with Alpine Linux Node.js
  2. Installs needed tools
  3. Copies package files first (good for caching)
  4. Installs npm packages
  5. Copies all project files
  6. Sets up environment settings
  7. Starts the app

Backend Dockerfile

FROM golang:1.16.5

WORKDIR /go/src/test/

COPY . .
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go get github.com/pilu/fresh
RUN go get github.com/swaggo/swag/cmd/[email protected]
RUN go get github.com/arsmn/fiber-swagger/v2
RUN go get gorm.io/[email protected]

ENTRYPOINT swag init --parseDependency --parseInternal && fresh

What this does:

  1. Starts with Golang image
  2. Sets the work folder
  3. Copies all files
  4. Downloads Go modules
  5. Gets tools for:
    • Hot-reloading
    • API docs
    • Swagger UI
    • Database work
  6. Sets up Swagger docs and starts the server

Docker Compose File

version: "3"
services:
  web-dev:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "3000:3000"
    volumes:
      - ./src:/app/src
    environment:
      - CHOKIDAR_USEPOLLING=true
    container_name: front-app

What this does:

  1. Makes a service called "web-dev"
  2. Builds it using our Dockerfile
  3. Maps port 3000
  4. Mounts src folder (for live updates)
  5. Sets an environment variable
  6. Names the container

Docker Commands Cheatsheet

CommandDescription
docker build -t myapp .Build an image
docker run -p 3000:3000 myappRun a container
docker psList running containers
docker imagesList images
docker-compose upStart services defined in docker-compose.yml
docker-compose downStop services
docker exec -it container_name bashAccess a running container
docker logs container_nameView container logs

What's Next?

In Week 4, we'll explore frontend development with React & TypeScript, building on our containerized approach. We'll see how Docker simplifies the development process and helps us create a consistent environment across our tech stack.


Stay tuned for next week's topic: Frontend Development with React & TypeScript.


image.png
Authentication interface
image.png
Question type selection interface
image.png
Interface for adding questions to a test
image.png
Interface for adding an MCQ-type question
image.png
Interface for inviting a candidate to a test
image.png
Candidate welcome interface

--

GitHub Repositories

Project Resources


What can you share in the club?

Our club is all about technology and development including:

  • Web & Mobile Development
  • AI & Machine Learning
  • DevOps & Cloud Technologies
  • Blockchain & Decentralized Applications
  • Open-source Contributions
  • Graphic Design & UI/UX

Any posts related to technology, reviews, information, tips, and practical experience must include original pictures, real-life reviews of the product, the changes it has brought to you, and a demonstration of practical experience

The club is open to everyone. Even if you're not interested in development, you can still share ideas for projects, and maybe someone will take the initiative to work on them and collaborate with you. Don’t worry if you don’t have much IT knowledge , just share your great ideas with us and provide feedback on the development projects. For example, if I create an extension, you can give your feedback as a user, test the specific project, and that will make you an important part of our club. We encourage people to talk and share posts and ideas related to Steemit.

For more information about the #techclub you can go through A New Era of Learning on Steemit: Join the Technology and Development Club. It has all the details about posting in the #techclub and if you have any doubts or needs clarification you can ask.


Our Club Rules

To ensure a fair and valuable experience, we have a few rules:

  1. No AI generated content. We want real human creativity and effort.
  2. Respect each other. This is a learning and collaborative space.
  3. No simple open source projects. If you submit an open source project, ensure you add significant modifications or improvements and share the source of the open source.
  4. Project code must be hosted in a Git repository (GitHub/GitLab preferred). If privacy is a concern, provide limited access to our mentors.
  5. Any post in our club that is published with the main tag #techclub please mention the mentors @kafio @mohammadfaisal @alejos7ven
  6. Use the tag #techclub, #techclub-s23w3, #country, other specific tags relevant to your post.
  7. In this thirdweek's #techclub you can participate from Monday, March 3, 2025, 00:00 UTC to Sunday, March 09, 2025, 23:59 UTC.
  8. Post the link to your entry in the comments section of this contest post. (Must)
  9. Invite at least 3 friends to participate.
  10. Try to leave valuable feedback on other people's entries.
  11. Share your post on Twitter and drop the link as a comment on your post.

Each post will be reviewed according to the working schedule as a major review which will have all the information about the post such as AI, Plagiarism, Creativity, Originality and suggestions for the improvements.

Other team members will also try to provide their suggestions just like a simple user but the major review will be one which will have all the details.


Rewards System

Sc01 and Sc02 will be visiting the posts of the users and participating teaching teams and learning clubs and upvoting outstanding content. Upvote is not guaranteed for all articles. Kindly take note.

Each week we will select Top 4 posts which has outperformed from others while maintaining the quality of their entry, interaction with other users, unique ideas, and creativity. These top 4 posts will receive additional winning rewards from SC01/SC02.

Note: If we find any valuable and outstanding comment than the post then we can select that comment as well instead of the post.



Best Regards
Technology and Development Club Team

Sort:  

Upvoted! Thank you for supporting witness @jswit.

@aneukpineung78
@grebmot

what do you think?

Note

Title: Unclear what the content is
Hashtags: please, use what fits to the topic how should anyone find this (back)?

#country is a hashtag because?

🍀

Kopie van #comment - cat read and support.jpg

I never understand programming, programming languages, and programmers. They live on different world, speak different language. So, I wouldn't bother, I will leave them be. =D

Just look at the picture, I left you something to complete.

Yes. I don't understand them.

Heh, I think I'm not smart enough to have strong opinions about that :-)

Coin Marketplace

STEEM 0.15
TRX 0.24
JST 0.033
BTC 90329.45
ETH 2286.75
SBD 0.63