Skip to content

Commit

Permalink
docker: Use python3.11-slim as a base image and clean up the build di…
Browse files Browse the repository at this point in the history
…rectory after package installation
  • Loading branch information
AbdouSeck committed Nov 15, 2023
1 parent c4a66ff commit 1acf94a
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 8 deletions.
88 changes: 88 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Specific to this project
.git
.gitignore
.github/
Expand All @@ -14,3 +15,90 @@ simeon.egg-info/
*.json
LICENSE
README.md

# More generic stuff
# Git
.gitattributes


# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml

# Docker
docker-compose.yml
Dockerfile
.docker
.dockerignore

# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Virtual environment
.env
.venv/

# PyCharm
.idea

# Python mode for VIM
.ropeproject
**/.ropeproject

# Vim swap files
**/*.swp

# VS Code
.vscode/
36 changes: 28 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
# Dockerfile for running simeon in a container
FROM python:3.8-slim
# set a key-value label for the Docker image
FROM python:3.11-slim
# Set a key-value label for the Docker image
LABEL maintainer="MIT Institutional Research"
LABEL email="irx@mit.edu"
COPY . /simeon
# defines the working directory within the container

# Create the home directory
RUN mkdir /simeon

# Create the simeon user and group
RUN useradd -d /simeon -r -U simeon
RUN chown simeon:simeon /simeon

# Define the working directory within the container
WORKDIR /simeon
# Update the repositories used by apt

# Add the requirements.txt file to start building the package
ADD requirements.txt /simeon/build_dir/requiremens.txt

# Update the repositories used by apt and install gpg
RUN apt-get update -y
# Install gpg
RUN apt-get install -y gnupg2

# Install python packages needed by simeon
RUN pip install -U wheel
RUN pip install -U pip wheel

# Install simeon with geoip support
RUN pip install .[geoip]
ADD . /simeon/build_dir/

# Clean up
RUN pip install /simeon/build_dir[geoip]
RUN rm -rf /simeon/*

# Set the user to simeon
USER simeon:simeon

# Start a shell
CMD [ "bash" ]

0 comments on commit 1acf94a

Please sign in to comment.