From b22b51009c8cbfcb39fc301ac0f675edf2ef5c92 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 15 Oct 2022 23:55:13 +0200 Subject: move Dockerfile to docker/ --- .github/workflows/ci.yml | 5 +++-- Dockerfile | 28 ---------------------------- docker-compose.yml | 1 + docker/Dockerfile | 28 ++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 30 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker/Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32d6d88..468c88c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,7 +76,7 @@ jobs: matrix: service: [backend, frontend] include: - - {service: backend, context: ., image: cgitize} + - {service: backend, file: docker/Dockerfile, image: cgitize} - {service: frontend, context: docker/frontend, image: cgitize-frontend} name: 'Publish / Docker Hub / ${{ matrix.service }}' if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) @@ -118,10 +118,11 @@ jobs: uses: docker/build-push-action@v2 with: context: '${{ matrix.context }}' + file: '${{ matrix.file }}' + labels: '${{ steps.meta.outputs.labels }}' platforms: '${{ steps.platforms.outputs.platforms }}' push: true tags: '${{ steps.meta.outputs.tags }}' - labels: '${{ steps.meta.outputs.labels }}' publish_pypi: needs: [test_local, test_example_config, test_docker, publish_docker] diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 9b9a8f6..0000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM alpine:3.15 AS base - -FROM base AS build - -RUN apk add --no-cache gcc libffi-dev make musl-dev python3-dev py3-pip - -COPY ["requirements.txt", "/tmp/"] -RUN pip3 install --no-cache-dir --target=/deps -r /tmp/requirements.txt - -FROM base - -LABEL maintainer="Egor Tensin " - -RUN apk add --no-cache bash git openssh-client python3 tini - -COPY --from=build ["/deps", "/deps/"] -ENV PYTHONPATH="/deps" - -ARG ssh_sock_dir=/ -ARG ssh_sock_path="$ssh_sock_dir/ssh-agent.sock" -ENV SSH_AUTH_SOCK "$ssh_sock_path" - -COPY ["docker/entrypoint.sh", "/"] -COPY ["cgitize/", "/usr/src/cgitize/"] -WORKDIR /usr/src - -ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"] -CMD ["python3", "-m", "cgitize.main"] diff --git a/docker-compose.yml b/docker-compose.yml index 21c061c..4aa183b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ services: cgitize: build: context: . + dockerfile: docker/Dockerfile environment: # Every 3 hours: SCHEDULE: '0 */3 * * *' diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..9b9a8f6 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3.15 AS base + +FROM base AS build + +RUN apk add --no-cache gcc libffi-dev make musl-dev python3-dev py3-pip + +COPY ["requirements.txt", "/tmp/"] +RUN pip3 install --no-cache-dir --target=/deps -r /tmp/requirements.txt + +FROM base + +LABEL maintainer="Egor Tensin " + +RUN apk add --no-cache bash git openssh-client python3 tini + +COPY --from=build ["/deps", "/deps/"] +ENV PYTHONPATH="/deps" + +ARG ssh_sock_dir=/ +ARG ssh_sock_path="$ssh_sock_dir/ssh-agent.sock" +ENV SSH_AUTH_SOCK "$ssh_sock_path" + +COPY ["docker/entrypoint.sh", "/"] +COPY ["cgitize/", "/usr/src/cgitize/"] +WORKDIR /usr/src + +ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"] +CMD ["python3", "-m", "cgitize.main"] -- cgit v1.2.3