Skip to content

Commit

Permalink
chore: change dockerfile due to moving to pyproject
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeAeich committed May 13, 2024
1 parent e16775a commit 0d29097
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 29 deletions.
17 changes: 15 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# cache and dot files
.eggs/
./deployment/containers/
.venv/
.mypy_cache/
.pytest_cache/
.coverage/
.ruff/
.ruff_cache/
.eggs/
.eggs/
.github/
.gitignore
# Docs and atifacts
./deployment
./docs
/images
# build
./build
./dist
# Scripts and tools
./scripts
Makefile
PULL_REQUEST_TEMPLATE.md
40 changes: 27 additions & 13 deletions deployment/containers/filer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
# Builder: produce wheels
###################################################
# Stage 1: Build wheel #
###################################################
FROM python:3.11-alpine AS builder

FROM alpine:3.10 as builder
# Set work directory
WORKDIR /app

RUN apk add --no-cache python3
RUN apk add --no-cache git
RUN python3 -m pip install --upgrade setuptools pip wheel
# Install poetry
RUN pip install poetry

WORKDIR /app/
# Copy source code
COPY . .

RUN python3 setup.py bdist_wheel
# Build wheel
RUN poetry build -f wheel

# Install: copy tesk-core*.whl and install it with dependencies
###################################################
# Stage 2: Install wheel and create user #
###################################################
FROM python:3.11-alpine AS runner

FROM alpine:3.10
# Copy built wheel from the builder stage
COPY --from=builder /app/dist/*.whl /dist/

RUN apk add --no-cache python3
# Install the application with dependencies
RUN pip install /dist/*.whl

COPY --from=builder /app/dist/tesk*.whl /root/
RUN python3 -m pip install --disable-pip-version-check --no-cache-dir /root/tesk*.whl
# Create a non-root user
RUN adduser -D -u 1000 filerUser

USER 100
# Switch to the non-root user
USER filerUser

# Set the working directory
WORKDIR /app

# Entrypoint command
ENTRYPOINT ["filer"]
41 changes: 27 additions & 14 deletions deployment/containers/taskmaster.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,39 @@
# Builder: produce wheels
###################################################
# Stage 1: Build wheel #
###################################################
FROM python:3.11-alpine AS builder

FROM alpine:3.10 as builder
# Set work directory
WORKDIR /app

RUN apk add --no-cache python3
RUN apk add --no-cache git
RUN python3 -m pip install --upgrade setuptools pip wheel
# Install poetry
RUN pip install poetry

WORKDIR /app/
# Copy source code
COPY . .

RUN python3 setup.py bdist_wheel
# Build wheel
RUN poetry build -f wheel

# Install: copy tesk-core*.whl and install it with dependencies
###################################################
# Stage 2: Install wheel and create user #
###################################################
FROM python:3.11-alpine AS runner

FROM alpine:3.10
# Copy built wheel from the builder stage
COPY --from=builder /app/dist/*.whl /dist/

RUN apk add --no-cache python3
# Install the application with dependencies
RUN pip install /dist/*.whl

COPY --from=builder /app/dist/tesk*.whl /root/
RUN python3 -m pip install --disable-pip-version-check --no-cache-dir /root/tesk*.whl
# Create a non-root user
RUN adduser -D -u 1000 taskmasterUser

RUN adduser --uid 100 -S taskmaster
USER 100
# Switch to the non-root user
USER taskmasterUser

# Set the working directory
WORKDIR /app

# Entrypoint command
ENTRYPOINT ["taskmaster"]
File renamed without changes.
Empty file removed tests/__init__.py
Empty file.
Empty file removed tests/test_unit/__init__.py
Empty file.
Empty file.

0 comments on commit 0d29097

Please sign in to comment.