Skip to content

Commit

Permalink
Less layers in build stages, remove unused variable
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 committed Jun 18, 2024
1 parent 0abee39 commit cc87b11
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
1 change: 0 additions & 1 deletion .github/actions/e2e-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ runs:
env:
E2E_TEST_TOKEN: ${{ inputs.e2e_test_token }}
SLACK_TOKEN: ${{ inputs.slack_token }}
STATIC_ASSET_CDN_URL: /
ENV: ${{ inputs.environment }}
GITHUB_ACTION_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
31 changes: 11 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ COPY frontend /app/frontend
# * build-node-django [build-node]
FROM build-node as build-node-django

RUN mkdir /app/api
ENV STATIC_ASSET_CDN_URL=/static/
RUN cd frontend && npm run bundledjango
RUN mkdir /app/api && cd frontend && npm run bundledjango

# * build-node-selfhosted [build-node]
FROM build-node as build-node-selfhosted
Expand All @@ -82,28 +80,22 @@ FROM python:3.11 as build-python
WORKDIR /app

COPY api/pyproject.toml api/poetry.lock api/Makefile ./
ENV POETRY_VIRTUALENVS_CREATE=false
ENV POETRY_HOME=/usr/local
ENV POETRY_VIRTUALENVS_CREATE=false POETRY_HOME=/usr/local
RUN make install opts='--without dev'

# * build-python-private [build-python]
FROM build-python AS build-python-private

# Authenticate git with token to install private packages
RUN --mount=type=secret,id=github_private_cloud_token \
echo "https://$(cat /run/secrets/github_private_cloud_token):@github.com" > ${HOME}/.git-credentials && \
git config --global credential.helper store

# Install SAML binary dependency
RUN apt-get update && apt-get install -y xmlsec1

# Install private Python dependencies
RUN make install-packages opts='--without dev --with saml,auth-controller,ldap,workflows'

# Integrate private modules
# Authenticate git with token, install SAML binary dependency,
# private Python dependencies, and integrate private modules
ARG SAML_REVISION
ARG RBAC_REVISION
RUN make install-private-modules
RUN --mount=type=secret,id=github_private_cloud_token \
echo "https://$(cat /run/secrets/github_private_cloud_token):@github.com" > ${HOME}/.git-credentials && \
git config --global credential.helper store && \
apt-get update && apt-get install -y xmlsec1 && \
make install-packages opts='--without dev --with saml,auth-controller,ldap,workflows' && \
make install-private-modules

# * api-runtime
FROM python:3.11-slim as api-runtime
Expand All @@ -114,8 +106,7 @@ COPY api /app/
COPY .release-please-manifest.json /app/.versions.json

ARG ACCESS_LOG_LOCATION="/dev/null"
ENV ACCESS_LOG_LOCATION=${ACCESS_LOG_LOCATION}
ENV DJANGO_SETTINGS_MODULE=app.settings.production
ENV ACCESS_LOG_LOCATION=${ACCESS_LOG_LOCATION} DJANGO_SETTINGS_MODULE=app.settings.production

RUN echo ${CI_COMMIT_SHA} > /app/CI_COMMIT_SHA

Expand Down
2 changes: 0 additions & 2 deletions docs/docs/deployment/hosting/locally-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ Current variables used between 'frontend/environment.js' and 'frontend/common/pr
- `MIXPANEL_API_KEY`: Mixpanel analytics key to use for behaviour tracking.
- `SENTRY_API_KEY`: Sentry key for error reporting.
- `ALBACROSS_CLIENT_ID`: Albacross client ID key for behaviour tracking.
- `STATIC_ASSET_CDN_URL`: Used for replacing local static paths with a cdn, .e.g https://cdn.flagsmith.com. Defaults to
`/`, i.e. no CDN.
- `BASE_URL`: Used for specifying a base url path that's ignored during routing if serving from a subdirectory.
- `USE_SECURE_COOKIES`: Enable / disable the use of secure cookies. If deploying the FE in a private network without a
domain / SSL cert, disable secure cookies to ensure that session token is persisted. Default: true.
Expand Down

0 comments on commit cc87b11

Please sign in to comment.