Skip to content
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
4 changes: 3 additions & 1 deletion result/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules/
node_modules
npm-debug.log
.git
11 changes: 5 additions & 6 deletions result/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
FROM node:18-slim
FROM node:20-slim

# add curl for healthcheck
RUN apt-get update && \
apt-get install -y --no-install-recommends curl tini && \
rm -rf /var/lib/apt/lists/*

WORKDIR /usr/local/app

# have nodemon available for local dev use (file watching)
RUN npm install -g nodemon

COPY package*.json ./

RUN npm ci && \
npm cache clean --force && \
mv /usr/local/app/node_modules /node_modules
npm cache clean --force && \
mv /usr/local/app/node_modules /node_modules

COPY . .

USER node
ENV PORT=80
EXPOSE 80

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["node", "server.js"]
CMD ["node", "server.js"]
4 changes: 4 additions & 0 deletions vote/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
__pycache__
*.pyc
.git
.venv
18 changes: 6 additions & 12 deletions vote/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
# base defines a base stage that uses the official python runtime base image
FROM python:3.11-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1

# Add curl for healthcheck
RUN apt-get update && \
apt-get install -y --no-install-recommends curl && \
rm -rf /var/lib/apt/lists/*

# Set the application directory
WORKDIR /usr/local/app

# Install our requirements.txt
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# dev defines a stage for development, where it'll watch for filesystem changes
FROM base AS dev
RUN pip install watchdog
ENV FLASK_ENV=development
CMD ["python", "app.py"]

# final defines the stage that will bundle the application for production
FROM base AS final

# Copy our code from the current folder to the working directory inside the container
COPY . .

# Make port 80 available for links and/or publish
EXPOSE 80
RUN useradd --no-create-home --uid 10001 appuser
USER appuser

# Define our command to be run when launching the container
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--log-file", "-", "--access-logfile", "-", "--workers", "4", "--keep-alive", "0"]
ENV PORT=8080
EXPOSE 8080
CMD ["sh", "-c", "exec gunicorn app:app -b 0.0.0.0:${PORT} --log-file - --access-logfile - --workers 4 --keep-alive 0"]
3 changes: 3 additions & 0 deletions worker/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin
obj
.git
12 changes: 2 additions & 10 deletions worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# because of dotnet, we always build on amd64, and target platforms in cli
# dotnet doesn't support QEMU for building or running.
# (errors common in arm/v7 32bit) https://github.com/dotnet/dotnet-docker/issues/1537
# https://hub.docker.com/_/microsoft-dotnet
# hadolint ignore=DL3029
# to build for a different platform than your host, use --platform=<platform>
# for example, if you were on Intel (amd64) and wanted to build for ARM, you would use:
# docker buildx build --platform "linux/arm64/v8" .

# build compiles the program for the builder's local platform
FROM --platform=${BUILDPLATFORM} mcr.microsoft.com/dotnet/sdk:7.0 AS build
ARG TARGETPLATFORM
Expand All @@ -25,4 +16,5 @@ RUN dotnet publish -c release -o /app -a $TARGETARCH --self-contained false --no
FROM mcr.microsoft.com/dotnet/runtime:7.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "Worker.dll"]
USER 10001
ENTRYPOINT ["dotnet", "Worker.dll"]