-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor Dockerfile setup for improved modularity and maintain…
…ability (#36)
- Loading branch information
1 parent
74b91e3
commit ce99943
Showing
7 changed files
with
94 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
poetry.lock | ||
docker/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM node:18-alpine as selfie-ui | ||
WORKDIR /selfie | ||
COPY selfie-ui/package.json selfie-ui/yarn.lock ./ | ||
RUN yarn install --frozen-lockfile --non-interactive | ||
COPY selfie-ui/ . | ||
RUN yarn run build | ||
|
||
FROM python:3.11 as selfie-arm64 | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
ENV PIP_NO_CACHE_DIR=1 | ||
|
||
WORKDIR /selfie | ||
COPY . . | ||
COPY --from=selfie-ui /selfie/out/ ./selfie-ui/out | ||
RUN pip install poetry --no-cache-dir | ||
RUN poetry config virtualenvs.create false | ||
RUN poetry install --no-interaction --no-ansi | ||
EXPOSE 8181 | ||
CMD ["python", "-m", "selfie", "--gpu", "--verbose"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM node:18-alpine as selfie-ui | ||
WORKDIR /selfie | ||
COPY selfie-ui/package.json selfie-ui/yarn.lock ./ | ||
RUN yarn install --frozen-lockfile --non-interactive | ||
COPY selfie-ui/ . | ||
RUN yarn run build | ||
|
||
FROM python:3.11 as selfie-cpu | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
ENV PIP_NO_CACHE_DIR=1 | ||
WORKDIR /selfie | ||
COPY . . | ||
COPY --from=selfie-ui /selfie/out/ ./selfie-ui/out | ||
RUN pip install poetry --no-cache-dir | ||
RUN poetry config virtualenvs.create false | ||
RUN poetry install --no-interaction --no-ansi | ||
EXPOSE 8181 | ||
CMD ["python", "-m", "selfie"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM node:18-alpine as selfie-ui | ||
WORKDIR /selfie | ||
COPY selfie-ui/package.json selfie-ui/yarn.lock ./ | ||
RUN yarn install --frozen-lockfile --non-interactive | ||
COPY selfie-ui/ . | ||
RUN yarn run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
TARGET_ARCH=$1 | ||
|
||
if [ -z "$TARGET_ARCH" ]; then | ||
echo "Please provide the target architecture (cpu, gpu, or arm64) as an argument." | ||
exit 1 | ||
fi | ||
|
||
case $TARGET_ARCH in | ||
cpu) | ||
docker build -t selfie:cpu -f docker/Dockerfile.ui -f docker/Dockerfile.cpu . | ||
;; | ||
gpu) | ||
docker build -t selfie:gpu -f docker/Dockerfile.ui -f docker/Dockerfile.gpu . | ||
;; | ||
arm64) | ||
docker build -t selfie:arm64 -f docker/Dockerfile.ui -f docker/Dockerfile.arm64 . | ||
;; | ||
*) | ||
echo "Invalid target architecture. Please choose from cpu, gpu, or arm64." | ||
exit 1 | ||
;; | ||
esac |