mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
ci: produce ubuntu and centos flavoured graphql-engine images
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3597 GitOrigin-RevId: f1fded72524f28f41433eea6819276932ee0b5cb
This commit is contained in:
parent
5920134dcb
commit
fac5e0b2c3
@ -161,6 +161,7 @@ function:
|
||||
- console: disable search indexing with HTML meta tag
|
||||
- cli: fix inherited roles metadata not being updated when dropping all roles (#7872)
|
||||
- cli: add support for customization field in sources metadata (#8292)
|
||||
- ci: ubuntu and centos flavoured graphql-engine images are now available
|
||||
|
||||
## v2.4.0-beta.2
|
||||
|
||||
|
@ -68,15 +68,15 @@ copy-cli-ext: clean-cli-ext
|
||||
test: copy-cli-ext
|
||||
echo "--- :: run test"
|
||||
if [ -z "${HASURA_TEST_CLI_HGE_DOCKER_IMAGE}" ]; then echo "Please set HASURA_TEST_CLI_HGE_DOCKER_IMAGE env for populating testutil.HasuraDockerImage and run test"; exit 1; fi
|
||||
go test -ldflags "-X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=$(VERSION)" -v -tags="${TEST_TAGS}" `go list ./... | grep -v integration_test | grep -v commands`
|
||||
go test -count=1 -ldflags "-X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=$(VERSION)" -v -tags="${TEST_TAGS}" `go list ./... | grep -v integration_test | grep -v commands`
|
||||
integration_tests_config_v3: copy-cli-ext
|
||||
echo "--- :: run integration_tests_config_v3"
|
||||
if [ -z "${HASURA_TEST_CLI_HGE_DOCKER_IMAGE}" ]; then echo "Please set HASURA_TEST_CLI_HGE_DOCKER_IMAGE env for populating testutil.HasuraDockerImage and run test"; exit 1; fi
|
||||
go test -ldflags "-X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=$(VERSION)" -v -tags="${TEST_TAGS}" -run Commands/config=v3 ./integration_test
|
||||
go test -count=1 -ldflags "-X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=$(VERSION)" -v -tags="${TEST_TAGS}" -run Commands/config=v3 ./integration_test
|
||||
integration_tests_config_v2: copy-cli-ext
|
||||
echo "--- :: run integration_tests_config_v2"
|
||||
if [ -z "${HASURA_TEST_CLI_HGE_DOCKER_IMAGE}" ]; then echo "Please set HASURA_TEST_CLI_HGE_DOCKER_IMAGE env for populating testutil.HasuraDockerImage and run test"; exit 1; fi
|
||||
go test -ldflags "-X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=$(VERSION)" -v -tags="${TEST_TAGS}" -run Commands/config=v2 ./integration_test
|
||||
go test -count=1 -ldflags "-X github.com/hasura/graphql-engine/cli/v2/version.BuildVersion=$(VERSION)" -v -tags="${TEST_TAGS}" -run Commands/config=v2 ./integration_test
|
||||
test-e2e:
|
||||
echo "--- :: run e2e tests"
|
||||
ifndef HAS_GINKGO
|
||||
|
25
packaging/README.md
Normal file
25
packaging/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
# Packaging
|
||||
|
||||
All things related to packaging graphql-engine.
|
||||
|
||||
## hasura/graphql-engine
|
||||
|
||||
([Docker hub](https://hub.docker.com/r/hasura/graphql-engine))
|
||||
|
||||
Production ready builds of the Hasura graphql-engine.
|
||||
|
||||
Supported tags:
|
||||
- `<version>`, `latest`
|
||||
- `<version>.cli-migrations-v2`, `latest.cli-migrations-v2`
|
||||
- `<version>.cli-migrations-v3`, `latest.cli-migrations-v3`
|
||||
|
||||
## hasura/graphql-engine-base
|
||||
|
||||
([Docker hub](https://hub.docker.com/r/hasura/graphql-engine-base))
|
||||
|
||||
This acts as base image for building `hasura/graphql-engine` image.
|
||||
|
||||
It is generally published with format `hasura/graphql-engine-base:<SHA256>.<OS>.<ARCH>` where
|
||||
- `<SHA256>` is the `sha256sum` of the dockerfile used to build the image
|
||||
- `OS` is the operating system. It could be any of these values: `debian`, `ubuntu`, `centos`
|
||||
- `ARCH` is the architecture. It could be any of these values: `amd64`, `arm64`
|
31
packaging/cli-migrations/v2/Dockerfile
Normal file
31
packaging/cli-migrations/v2/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
ARG BASE_IMAGE
|
||||
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
RUN { apt-get update && apt-get install -y netcat; } \
|
||||
|| { yum update -y && yum install -y nc; }
|
||||
|
||||
# When a non-root user without home directory is trying to use the cli-migrations image
|
||||
# then hasura cli will try to create .hasura folder at the root but would fail due to permissions
|
||||
# (example: OpenShift runs containers by using a random user-id which is homeless and non-root)
|
||||
# The following commands give the right permissions for /.hasura folder
|
||||
RUN mkdir -p /.hasura \
|
||||
&& chgrp -R 0 /.hasura \
|
||||
&& chmod -R g=u /.hasura
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# update notification is disabled
|
||||
ENV HASURA_GRAPHQL_SHOW_UPDATE_NOTIFICATION=false
|
||||
|
||||
COPY docker-entrypoint.sh /bin/
|
||||
COPY hasura-cli /bin/hasura-cli
|
||||
|
||||
RUN chmod +x /bin/hasura-cli
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# it is running in server environment
|
||||
ENV HASURA_GRAPHQL_CLI_ENVIRONMENT=server-on-docker
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["graphql-engine", "serve"]
|
31
packaging/cli-migrations/v3/Dockerfile
Normal file
31
packaging/cli-migrations/v3/Dockerfile
Normal file
@ -0,0 +1,31 @@
|
||||
ARG BASE_IMAGE
|
||||
|
||||
FROM ${BASE_IMAGE}
|
||||
|
||||
RUN { apt-get update && apt-get install -y netcat; } \
|
||||
|| { yum update -y && yum install -y nc; }
|
||||
|
||||
# When a non-root user without home directory is trying to use the cli-migrations image
|
||||
# then hasura cli will try to create .hasura folder at the root but would fail due to permissions
|
||||
# (example: OpenShift runs containers by using a random user-id which is homeless and non-root)
|
||||
# The following commands give the right permissions for /.hasura folder
|
||||
RUN mkdir -p /.hasura \
|
||||
&& chgrp -R 0 /.hasura \
|
||||
&& chmod -R g=u /.hasura
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# update notification is disabled
|
||||
ENV HASURA_GRAPHQL_SHOW_UPDATE_NOTIFICATION=false
|
||||
|
||||
COPY docker-entrypoint.sh /bin/
|
||||
COPY hasura-cli /bin/hasura-cli
|
||||
|
||||
RUN chmod +x /bin/hasura-cli
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# it is running in server environment
|
||||
ENV HASURA_GRAPHQL_CLI_ENVIRONMENT=server-on-docker
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["graphql-engine", "serve"]
|
49
packaging/graphql-engine-base/centos.dockerfile
Normal file
49
packaging/graphql-engine-base/centos.dockerfile
Normal file
@ -0,0 +1,49 @@
|
||||
# DATE VERSION: 2022-03-10
|
||||
# Modify the above date version (YYYY-MM-DD) if you want to rebuild the image for security updates
|
||||
FROM quay.io/centos/centos:stream8
|
||||
|
||||
# TARGETPLATFORM is automatically set up by docker buildx based on the platform we are targetting for
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
RUN groupadd -g 1001 hasura && useradd -m -u 1001 -g hasura hasura
|
||||
|
||||
# Dependencies taken from: https://github.com/0x777/hge-arm-dockerfiles/blob/master/hge.df
|
||||
# Below are the CentOS libraries matching these apt/Debian ones:
|
||||
# libpq5 libkrb5-3 libnuma1 ca-certificates (ca-certificates are preinstalled)
|
||||
RUN yum update -y \
|
||||
&& yum install -y dnf \
|
||||
&& dnf upgrade \
|
||||
&& dnf -qy module disable postgresql \
|
||||
&& dnf install -y \
|
||||
krb5-libs \
|
||||
numactl-libs \
|
||||
libstdc++ \
|
||||
&& case "$TARGETPLATFORM" in \
|
||||
"linux/amd64") \
|
||||
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm \
|
||||
&& dnf install -y postgresql13-devel \
|
||||
;; \
|
||||
"linux/arm64") \
|
||||
dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-aarch64/pgdg-redhat-repo-latest.noarch.rpm \
|
||||
# TODO: remove --nogpgcheck after resolving https://www.postgresql.org/message-id/flat/CAA77xwWaf_ZhaTe6qS0O5vrJjx5pJs07GYipn7ZCbMrXfeVqTA%40mail.gmail.com
|
||||
&& dnf install -y --nogpgcheck postgresql13-devel \
|
||||
# TODO: remove following command after removing --nogpgcheck above
|
||||
# The following file seem to cause installation issue with packages in the next steps
|
||||
# Hence this file is removed here
|
||||
&& rm -rf /etc/yum.repos.d/pgdg-redhat-all.repo \
|
||||
;; \
|
||||
esac
|
||||
|
||||
# msodbcsql17
|
||||
RUN yum remove unixODBC-utf16 unixODBC-utf16-devel \
|
||||
&& yum install -y unixODBC-devel \
|
||||
&& if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
|
||||
curl https://packages.microsoft.com/config/rhel/8/prod.repo > /etc/yum.repos.d/mssql-release.repo \
|
||||
&& ACCEPT_EULA=Y yum install -y msodbcsql17 ; \
|
||||
fi
|
||||
|
||||
# mysql
|
||||
RUN dnf install -y mariadb-connector-c pcre-devel \
|
||||
&& ln -s /usr/lib64/libpcre.so /usr/lib64/libpcre.so.3
|
||||
|
||||
RUN yum clean all && rm -rf /var/cache/yum
|
29
packaging/graphql-engine-base/debian.dockerfile
Normal file
29
packaging/graphql-engine-base/debian.dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
FROM debian:buster-20210511-slim
|
||||
|
||||
# TARGETPLATFORM is automatically set up by docker buildx based on the platform we are targetting for
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
||||
|
||||
RUN groupadd -g 1001 hasura && useradd -m -u 1001 -g hasura hasura
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg2 curl apt-transport-https \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y ca-certificates libkrb5-3 libpq5 libnuma1 unixodbc-dev default-libmysqlclient-dev default-mysql-client
|
||||
|
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
|
||||
curl -s https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql-release.list \
|
||||
&& curl -s https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
|
||||
&& apt-get update \
|
||||
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 ; \
|
||||
fi
|
||||
|
||||
# Cleanup unwanted files and packages
|
||||
RUN apt-get -y remove curl gnupg2 \
|
||||
&& apt-get -y auto-remove \
|
||||
&& apt-get -y clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /usr/share/doc/ \
|
||||
&& rm -rf /usr/share/man/ \
|
||||
&& rm -rf /usr/share/locale/
|
29
packaging/graphql-engine-base/ubuntu.dockerfile
Normal file
29
packaging/graphql-engine-base/ubuntu.dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
FROM ubuntu:20.04
|
||||
|
||||
# TARGETPLATFORM is automatically set up by docker buildx based on the platform we are targetting for
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
||||
|
||||
RUN groupadd -g 1001 hasura && useradd -m -u 1001 -g hasura hasura
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg2 curl apt-transport-https \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y ca-certificates libkrb5-3 libpq5 libnuma1 unixodbc-dev libmariadb-dev-compat mariadb-client-10.3
|
||||
|
||||
RUN if [ "$TARGETPLATFORM" = "linux/amd64" ] ; then \
|
||||
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
|
||||
&& curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list \
|
||||
&& apt-get update \
|
||||
&& ACCEPT_EULA=Y apt-get install -y msodbcsql17 ; \
|
||||
fi
|
||||
|
||||
# Cleanup unwanted files and packages
|
||||
RUN apt-get -y remove curl gnupg2 \
|
||||
&& apt-get -y auto-remove \
|
||||
&& apt-get -y clean \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /usr/share/doc/ \
|
||||
&& rm -rf /usr/share/man/ \
|
||||
&& rm -rf /usr/share/locale/
|
@ -1,22 +0,0 @@
|
||||
ARG SERVER_IMAGE_TAG
|
||||
|
||||
FROM hasura/graphql-engine:${SERVER_IMAGE_TAG}
|
||||
|
||||
RUN apt-get update && apt-get install -y netcat
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# update notification is disabled
|
||||
ENV HASURA_GRAPHQL_SHOW_UPDATE_NOTIFICATION=false
|
||||
|
||||
COPY docker-entrypoint.sh /bin/
|
||||
COPY hasura-cli /bin/hasura-cli
|
||||
|
||||
RUN chmod +x /bin/hasura-cli
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# it is running in server environment
|
||||
ENV HASURA_GRAPHQL_CLI_ENVIRONMENT=server-on-docker
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["graphql-engine", "serve"]
|
@ -1,22 +0,0 @@
|
||||
ARG SERVER_IMAGE_TAG
|
||||
|
||||
FROM hasura/graphql-engine:${SERVER_IMAGE_TAG}
|
||||
|
||||
RUN apt-get update && apt-get install -y netcat
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# update notification is disabled
|
||||
ENV HASURA_GRAPHQL_SHOW_UPDATE_NOTIFICATION=false
|
||||
|
||||
COPY docker-entrypoint.sh /bin/
|
||||
COPY hasura-cli /bin/hasura-cli
|
||||
|
||||
RUN chmod +x /bin/hasura-cli
|
||||
|
||||
# set an env var to let the cli know that
|
||||
# it is running in server environment
|
||||
ENV HASURA_GRAPHQL_CLI_ENVIRONMENT=server-on-docker
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
|
||||
CMD ["graphql-engine", "serve"]
|
Loading…
Reference in New Issue
Block a user