Skip to content

Commit 9bc816f

Browse files
Tony QiuTony Qiu
authored andcommitted
use arm64 in github actions to build django image
1 parent f6763ac commit 9bc816f

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.github/workflows/deploy-backend.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,14 @@ jobs:
3737
id: login-ecr
3838
uses: aws-actions/amazon-ecr-login@v2
3939

40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
4043
- name: Build Docker image
4144
run: |
4245
IMAGE_URI=${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG}
43-
echo "Building ${IMAGE_URI}"
44-
docker build -f backend/Dockerfile -t ${IMAGE_URI} backend
46+
echo "Building ${IMAGE_URI} for ARM64"
47+
docker buildx build --platform linux/arm64 -f backend/Dockerfile -t ${IMAGE_URI} --load backend
4548
4649
- name: Push Docker image
4750
run: |

backend/Dockerfile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Use official Python runtime as base image
2-
# Use ARM64 architecture (native for M4 Mac Mini)
3-
FROM --platform=linux/arm64 python:3.11-slim
2+
FROM python:3.11-slim
43

54
# Set environment variables
65
ENV PYTHONUNBUFFERED=1 \
@@ -21,16 +20,11 @@ RUN pip install -r requirements.txt
2120
COPY . .
2221

2322
# Copy and set up entrypoint script
24-
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
25-
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
26-
# Ensure Unix line endings and verify the script
27-
sed -i 's/\r$//' /usr/local/bin/docker-entrypoint.sh && \
28-
ls -la /usr/local/bin/docker-entrypoint.sh && \
29-
head -1 /usr/local/bin/docker-entrypoint.sh
23+
COPY docker-entrypoint.sh /usr/local/bin/
24+
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
3025

3126
# Expose port
3227
EXPOSE 3000
3328

3429
# Use entrypoint script
35-
ENTRYPOINT ["docker-entrypoint.sh"]
36-
30+
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

0 commit comments

Comments
 (0)