Skip to content

Commit

Permalink
Simplify Docker setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Delemangi committed Mar 3, 2024
1 parent 4a7f188 commit c9ad190
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 63 deletions.
File renamed without changes.
13 changes: 0 additions & 13 deletions .devcontainer/frontend/devcontainer.json

This file was deleted.

27 changes: 8 additions & 19 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,21 @@
ARG PLATFORM="linux/amd64"

# Development stage
FROM python:3.11-alpine AS development
FROM --platform=${BUILDPLATFORM} python:3.11 AS development
WORKDIR /workspace/backend

RUN apk add --no-cache postgresql-client git openjdk17 nodejs

RUN pip install poetry
COPY ./pyproject.toml ./poetry.lock ./
RUN pip install poetry

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
RUN poetry install
RUN poetry install && poetry export -f requirements.txt --output requirements.txt --without-hashes

COPY . ./

CMD ["sh", "./start.sh", "reload"]

# Production stage
FROM --platform=${PLATFORM} python:3.11-alpine AS production
FROM --platform=${TARGETPLATFORM} python:3.11 AS production
WORKDIR /workspace/backend

RUN apk add --no-cache postgresql-client build-base

COPY ./start.sh ./start.sh

COPY --from=development /workspace/backend/requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --upgrade -r /workspace/backend/requirements.txt
COPY --from=development ./requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --upgrade -r ./requirements.txt

COPY ./app /workspace/backend/app
COPY ./app ./app

CMD ["sh", "./start.sh"]
CMD [ "python", "-m", "app.main" ]
14 changes: 0 additions & 14 deletions backend/start.sh

This file was deleted.

25 changes: 8 additions & 17 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
ARG PLATFORM="linux/amd64"

# Development stage
FROM node:20-alpine AS development
FROM --platform=${BUILDPLATFORM} node:20 AS development
WORKDIR /workspace/frontend

RUN apk add --no-cache postgresql-client git openjdk17 nodejs

COPY package.json package-lock.json ./
RUN npm i
RUN npm ci --ignore-scripts

COPY . ./
RUN npm run build

CMD ["npm", "run", "dev"]
COPY . ./

# Production stage
FROM --platform=${PLATFORM} node:20-alpine AS production
FROM --platform=${TARGETPLATFORM} node:20 AS production
WORKDIR /workspace/frontend

RUN apk add --no-cache postgresql-client

COPY package.json ./
COPY --from=development /workspace/frontend/node_modules ./node_modules
RUN npm prune --production && npm i --ignore-scripts vite
COPY --from=development /workspace/frontend .

COPY . ./
RUN npm run build
RUN npm prune --production

CMD ["npm", "run", "preview"]
CMD [ "npm", "run", "preview" ]

0 comments on commit c9ad190

Please sign in to comment.