TESK
TESK copied to clipboard
chore: only one Dockerfile
Currently we have 2 dockerfile for filer and taskmaster, and with implementation of API we will also have another. This might be pointless as we are packaging all the components of tesk
. Which means we will have to install tesk
in all of the images and the only change that will be there will be entry point.
I porpose that we have one image that installs tesk
, and pass the entrypoint as console script as while using running the image as container. checkout current poetry console script:
[tool.poetry.scripts]
filer = 'tesk.services.filer:main'
taskmaster = 'tesk.services.taskmaster:main'
api = 'tesk.api.app:main' <-- added after api impl
The
###################################################
# Stage 1: Build wheel #
###################################################
FROM python:3.11-alpine AS builder
# Set work directory
WORKDIR /app
# Install poetry
RUN pip install poetry
# Copy source code
COPY . .
# Build wheel
RUN poetry build -f wheel
###################################################
# Stage 2: Install wheel and create user #
###################################################
FROM python:3.11-alpine AS runner
# Copy built wheel from the builder stage
COPY --from=builder /app/dist/*.whl /dist/
# Install the application with dependencies
RUN pip install /dist/*.whl
# Create a non-root user
RUN adduser -D -u 1000 filerUser
# Switch to the non-root user
USER filerUser
# Set the working directory
WORKDIR /app
# Entrypoint command
ENTRYPOINT ["filer"] <-- pass as env
The only diff between both the image is the Entrypoint.
PS: This might be blocked till foca still needs Docker to be able to run.