feat(dockerfile): layered images [EE-4879] (#8301)

* multistage build to target production and storybook

* missing slash

* add storybook for windows too and build targets

* feature flag the storybook api

* remove kompose and prep for new FF lib

* todo comment for FF

* update to new feature flags library

* simplify logic

* fix compilation error

* simplified it
pull/8485/head
Matt Hook 2 years ago committed by GitHub
parent 58d66d3142
commit b2105f3614
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -506,9 +506,6 @@ type (
// ExtensionID represents a extension identifier
ExtensionID int
// Feature represents a feature that can be enabled or disabled via feature flags
Feature string
// GitlabRegistryData represents data required for gitlab registry to work
GitlabRegistryData struct {
ProjectID int `json:"ProjectId"`
@ -871,13 +868,13 @@ type (
// A list of label name & value that will be used to hide containers when querying containers
BlackListedLabels []Pair `json:"BlackListedLabels"`
// Active authentication method for the Portainer instance. Valid values are: 1 for internal, 2 for LDAP, or 3 for oauth
AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod" example:"1"`
InternalAuthSettings InternalAuthSettings `json:"InternalAuthSettings"`
LDAPSettings LDAPSettings `json:"LDAPSettings"`
OAuthSettings OAuthSettings `json:"OAuthSettings"`
OpenAMTConfiguration OpenAMTConfiguration `json:"openAMTConfiguration"`
FDOConfiguration FDOConfiguration `json:"fdoConfiguration"`
FeatureFlagSettings map[Feature]bool `json:"FeatureFlagSettings"`
AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod" example:"1"`
InternalAuthSettings InternalAuthSettings `json:"InternalAuthSettings"`
LDAPSettings LDAPSettings `json:"LDAPSettings"`
OAuthSettings OAuthSettings `json:"OAuthSettings"`
OpenAMTConfiguration OpenAMTConfiguration `json:"openAMTConfiguration"`
FDOConfiguration FDOConfiguration `json:"fdoConfiguration"`
FeatureFlagSettings map[featureflags.Feature]bool `json:"FeatureFlagSettings"`
// The interval in which environment(endpoint) snapshots are created
SnapshotInterval string `json:"SnapshotInterval" example:"5m"`
// URL to the templates that will be displayed in the UI when navigating to App Templates
@ -1532,11 +1529,8 @@ const (
WebSocketKeepAlive = 1 * time.Hour
)
// SupportFeatureFlags is a list of supported features. They should all be lower case
// e.g. "microk8s","kaas"
var SupportedFeatureFlags = []featureflags.Feature{
"microk8s",
}
// List of supported features
var SupportedFeatureFlags = []featureflags.Feature{}
const (
_ AuthenticationMethod = iota

@ -1,4 +1,4 @@
FROM portainer/base
FROM portainer/base as production
LABEL org.opencontainers.image.title="Portainer" \
org.opencontainers.image.description="Docker container management made simple, with the worlds most popular GUI-based container management platform." \
@ -10,9 +10,19 @@ LABEL org.opencontainers.image.title="Portainer" \
com.docker.extension.publisher-url="https://www.portainer.io" \
com.docker.extension.additional-urls="[{\"title\":\"Website\",\"url\":\"https://www.portainer.io?utm_campaign=DockerCon&utm_source=DockerDesktop\"},{\"title\":\"Documentation\",\"url\":\"https://docs.portainer.io\"},{\"title\":\"Support\",\"url\":\"https://join.slack.com/t/portainer/shared_invite/zt-txh3ljab-52QHTyjCqbe5RibC2lcjKA\"}]"
COPY dist /
COPY dist/docker /
COPY dist/docker-compose /
COPY dist/helm /
COPY dist/kubectl /
COPY dist/mustache-templates /mustache-templates/
COPY dist/portainer /
COPY dist/public /public/
COPY build/docker-extension /
# storybook exists only in portainerci builds
COPY dist/storybook* /storybook/
VOLUME /data
WORKDIR /
@ -23,3 +33,4 @@ EXPOSE 8000
LABEL io.portainer.server true
ENTRYPOINT ["/portainer"]

@ -1,6 +1,27 @@
FROM alpine:latest
FROM alpine:latest as production
COPY dist /
LABEL org.opencontainers.image.title="Portainer" \
org.opencontainers.image.description="Docker container management made simple, with the worlds most popular GUI-based container management platform." \
org.opencontainers.image.vendor="Portainer.io" \
com.docker.desktop.extension.api.version=">= 0.2.2" \
com.docker.desktop.extension.icon="https://portainer-io-assets.sfo2.cdn.digitaloceanspaces.com/logos/portainer.png" \
com.docker.extension.screenshots="[{\"alt\": \"screenshot one\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-1.png\"},{\"alt\": \"screenshot two\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-2.png\"},{\"alt\": \"screenshot three\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-3.png\"},{\"alt\": \"screenshot four\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-4.png\"},{\"alt\": \"screenshot five\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-5.png\"},{\"alt\": \"screenshot six\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-6.png\"},{\"alt\": \"screenshot seven\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-7.png\"},{\"alt\": \"screenshot eight\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-8.png\"},{\"alt\": \"screenshot nine\", \"url\": \"https://portainer-io-assets.sfo2.digitaloceanspaces.com/screenshots/docker-extension-9.png\"}]" \
com.docker.extension.detailed-description="<p data-renderer-start-pos=\"226\">Portainer&rsquo;s Docker Desktop extension gives you access to all of Portainer&rsquo;s rich management functionality within your docker desktop experience.</p><h2 data-renderer-start-pos=\"374\">With Portainer you can:</h2><ul><li>See all your running containers</li><li>Easily view all of your container logs</li><li>Console into containers</li><li>Easily deploy your code into containers using a simple form</li><li>Turn your YAML into custom templates for easy reuse</li></ul><h2 data-renderer-start-pos=\"660\">About Portainer&nbsp;</h2><p data-renderer-start-pos=\"680\">Portainer is the worlds&rsquo; most popular universal container management platform with more than 650,000 active monthly users. Portainer can be used to manage Docker Standalone, Kubernetes, Docker Swarm and Nomad environments through a single common interface. It includes a simple GitOps automation engine and a Kube API.&nbsp;</p><p data-renderer-start-pos=\"1006\">Portainer Business Edition is our fully supported commercial grade product for business-wide use. It includes all the functionality that businesses need to manage containers at scale. Visit <a class=\"sc-jKJlTe dPfAtb\" href=\"http://portainer.io/\" title=\"http://Portainer.io\" data-renderer-mark=\"true\">Portainer.io</a> to learn more about Portainer Business and <a class=\"sc-jKJlTe dPfAtb\" href=\"http://portainer.io/take5?utm_campaign=DockerCon&amp;utm_source=Docker%20Desktop\" title=\"http://portainer.io/take5?utm_campaign=DockerCon&amp;utm_source=Docker%20Desktop\" data-renderer-mark=\"true\">get 5 free nodes.</a></p>" \
com.docker.extension.publisher-url="https://www.portainer.io" \
com.docker.extension.additional-urls="[{\"title\":\"Website\",\"url\":\"https://www.portainer.io?utm_campaign=DockerCon&utm_source=DockerDesktop\"},{\"title\":\"Documentation\",\"url\":\"https://docs.portainer.io\"},{\"title\":\"Support\",\"url\":\"https://join.slack.com/t/portainer/shared_invite/zt-txh3ljab-52QHTyjCqbe5RibC2lcjKA\"}]"
COPY dist/docker /
COPY dist/docker-compose /
COPY dist/helm /
COPY dist/kubectl /
COPY dist/mustache-templates /mustache-templates/
COPY dist/portainer /
COPY dist/public /public/
COPY build/docker-extension /
# storybook exists only in portainerci builds
COPY dist/storybook* /storybook/
VOLUME /data
WORKDIR /
@ -12,3 +33,4 @@ EXPOSE 8000
LABEL io.portainer.server true
ENTRYPOINT ["/portainer"]

@ -5,10 +5,10 @@ ENV GIT_VERSION 2.30.0
ENV GIT_PATCH_VERSION 2
RUN mkdir mingit/ \
&& wget https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.$GIT_PATCH_VERSION/MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip \
&& unzip MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip -d mingit/
&& wget https://github.com/git-for-windows/git/releases/download/v$GIT_VERSION.windows.$GIT_PATCH_VERSION/MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip \
&& unzip MinGit-$GIT_VERSION.$GIT_PATCH_VERSION-busybox-64-bit.zip -d mingit/
FROM mcr.microsoft.com/windows/nanoserver:${OSVERSION}
FROM mcr.microsoft.com/windows/nanoserver:${OSVERSION} as production
ENV PATH "C:\mingit\cmd;C:\Windows\system32;C:\Windows;"
COPY --from=downloader /mingit mingit/
@ -16,7 +16,16 @@ COPY --from=core /Windows/System32/netapi32.dll /Windows/System32/netapi32.dll
USER ContainerAdministrator
COPY dist /
COPY dist/docker.exe /
COPY dist/docker-compose.exe /
COPY dist/helm.exe /
COPY dist/kubectl.exe /
COPY dist/mustache-templates /mustache-templates/
COPY dist/portainer.exe /
COPY dist/public /public/
# storybook exists only in portainerci builds
COPY dist/storybook* /storybook/
EXPOSE 9000
EXPOSE 9443

@ -124,7 +124,7 @@ gruntConfig.shell = {
};
function shell_storybook(env) {
if (env === 'production') {
if (env === 'prod') {
return '';
}

Loading…
Cancel
Save