Skip to content

Commit

Permalink
Create Dockerfile
Browse files Browse the repository at this point in the history
This commit introduces a basic container-based runtime by adding a
Dockerfile.

Related issue: pbp-fasilkom-ui#5
  • Loading branch information
addianto committed Aug 31, 2023
1 parent fb065f8 commit 57a43a1
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 5 deletions.
78 changes: 78 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Virtual environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Python cache files
__pycache__/

# SQLite database
db.sqlite3
db.sqlite3-journal

# User-uploaded media
media

# Collected static files
staticfiles/

# Coverage
.coverage
.coverage.*
coverage.*
htmlcov/

# Chromedriver
chromedriver
chromedriver.exe

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows shortcuts
*.lnk
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ ehthumbs_vista.db
$RECYCLE.BIN/

# Windows shortcuts
*.lnk
*.lnk
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.6
3.11.5
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use official Python container image
FROM docker.io/library/python:3.11.5-alpine

# Configure environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONBUFFERED=1

# TODO: Configure environment variables required by Django project
# e.g., database connection, parameterised configuration in settings.py

# Set the active working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install the declared app dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the source code files into the container
COPY . .

# Expose the port that the app will run on
EXPOSE 8000

# Run the app
CMD ["/bin/sh", "-c", "python manage.py migrate && gunicorn project_django.wsgi --log-file -"]
3 changes: 1 addition & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
release: python manage.py migrate
web: gunicorn project_django.wsgi --log-file -
web: python manage.py migrate && gunicorn project_django.wsgi --log-file -
2 changes: 1 addition & 1 deletion runtime.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
python-3.10.6
python-3.11.5

0 comments on commit 57a43a1

Please sign in to comment.