Compare commits

...

4 Commits

Author SHA1 Message Date
John Wang
519ea00787 feat: test 2023-08-31 21:55:24 +08:00
John Wang
e5af8833a6 test: add gcc 2023-08-31 21:40:31 +08:00
John Wang
431a17cd60 test: multi platform 2023-08-31 20:56:09 +08:00
John Wang
19d64821c1 test: new dockerfile 2023-08-31 20:55:45 +08:00
2 changed files with 21 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ on:
branches:
- 'main'
- 'deploy/dev'
- 'test/new-dockerfile'
release:
types: [published]
@@ -42,7 +43,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:api"
platforms: ${{ startsWith(github.ref, 'refs/tags/') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
platforms: 'linux/amd64,linux/arm64'
build-args: |
COMMIT_SHA=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}
push: true

View File

@@ -1,7 +1,20 @@
FROM python:3.10-slim
# packages install stage
FROM python:3.10-slim AS base
LABEL maintainer="takatost@gmail.com"
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc gcc g++ python3-dev libc-dev libffi-dev \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
COPY requirements.txt /requirements.txt
RUN pip install --prefix=/pkg -r requirements.txt
# build stage
FROM python:3.10-slim AS builder
ENV FLASK_APP app.py
ENV EDITION SELF_HOSTED
ENV DEPLOY_ENV PRODUCTION
@@ -15,13 +28,12 @@ EXPOSE 5001
WORKDIR /app/api
RUN apt-get update && \
apt-get install -y bash curl wget vim gcc g++ python3-dev libc-dev libffi-dev nodejs
COPY requirements.txt /app/api/requirements.txt
RUN pip install -r requirements.txt
RUN apt-get update \
&& apt-get install -y --no-install-recommends bash curl wget vim nodejs \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
COPY --from=base /pkg /usr/local
COPY . /app/api/
COPY docker/entrypoint.sh /entrypoint.sh