Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Docker configuration for Tetris game #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
.gitignore
.dockerignore
Dockerfile
README.md
LICENSE
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Use the official nginx alpine as the base image for a lightweight container
# Alpine-based images are smaller in size and more secure
FROM nginx:alpine

# Set the working directory in the container
# This is where our application files will be placed
WORKDIR /usr/share/nginx/html

# Copy all files from the current directory (.) to the working directory in the container (.)
# This includes HTML, CSS, JavaScript, and other static files
COPY . .

# Create custom Nginx configuration to listen on port 5000
RUN echo 'server { \
listen 5000; \
server_name localhost; \
location / { \
root /usr/share/nginx/html; \
index index.html index.htm; \
} \
}' > /etc/nginx/conf.d/default.conf

# Expose port 5000 for the Nginx web server
# This matches the port mapping in the docker run command (-p 5000:5000)
EXPOSE 5000

# Start the Nginx server in the foreground
# The 'daemon off' directive is required to run nginx in the foreground
# This is important for Docker containers as they should run in the foreground
CMD ["nginx", "-g", "daemon off;"]