-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update build workflow to support multiple platforms
- Loading branch information
Showing
6 changed files
with
50 additions
and
21 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
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,15 +1,29 @@ | ||
# https://hub.docker.com/alpine/git | ||
FROM alpine/git as src | ||
# https://hub.docker.com/_/debian/ | ||
FROM --platform=$BUILDPLATFORM debian as src | ||
RUN apt-get update && apt-get install -y git | ||
ARG GIT_HASH="master" | ||
WORKDIR /code | ||
RUN git clone https://github.com/nezhar/snypy-backend --single-branch --branch $GIT_HASH . | ||
|
||
# https://hub.docker.com/_/python | ||
FROM python:3.10-slim | ||
FROM python:3.12-slim | ||
COPY --from=src /code/snypy /usr/src/app/snypy | ||
COPY --from=src /code/requirements.txt /usr/src/app/snypy/requirements.txt | ||
WORKDIR /usr/src/app/snypy | ||
RUN pip install --no-cache-dir pip gunicorn psycopg2-binary -U | ||
RUN pip install --no-cache-dir pip gunicorn -U | ||
|
||
ARG TARGETPLATFORM | ||
# run the command if it does not match arm/v7 | ||
RUN if [ "$TARGETPLATFORM" != "linux/arm/v7" ]; then \ | ||
pip install --no-cache-dir psycopg2-binary; \ | ||
fi | ||
# run the command if it matches arm/v7 | ||
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \ | ||
apt-get update && apt-get install -y libpq-dev gcc && \ | ||
pip install --no-cache-dir psycopg2; \ | ||
apt-get remove -y libpq-dev gcc && apt-get autoremove -y; \ | ||
fi | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
EXPOSE 8000 | ||
EXPOSE 8000 |
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,8 +1,8 @@ | ||
# https://hub.docker.com/_/python | ||
FROM python:3.10-slim | ||
FROM python:3.12-slim | ||
WORKDIR /usr/src/app/snypy | ||
COPY /code/snypy-backend/requirements.txt /usr/src/app/snypy/requirements.txt | ||
RUN pip install --no-cache-dir pip gunicorn psycopg2-binary -U | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
EXPOSE 8000 | ||
EXPOSE 8000 |
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
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