Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 13 additions & 28 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
name: Deploy to environment

# Manual deployment only - user must select application and environment
on:
push:
branches:
- main
workflow_dispatch:
inputs:
application:
type: choice
description: "Choose an application to deploy"
required: true
options:
- Transfers
- Lsrp
- RGVisits
environment:
type: choice
type: environment
description: "Choose an environment to deploy to"
required: true
options:
- development
- test
- production

concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.application }}-${{ github.event.inputs.environment }}-${{ github.run_number }}
group: ${{ github.workflow }}-${{ github.event.inputs.environment }}-${{ github.run_number }}

env:
IMAGE_NAME: flexformsweb

permissions:
contents: read
packages: read

jobs:
set-env:
name: Preflight
runs-on: ubuntu-24.04
outputs:
application: ${{ steps.var.outputs.application }}
environment: ${{ steps.var.outputs.environment }}
branch: ${{ steps.var.outputs.branch }}
checked-out-sha: ${{ steps.var.outputs.checked-out-sha }}
Expand All @@ -42,21 +38,10 @@ jobs:
run: |
GIT_REF=${{ github.ref_name }}
GIT_BRANCH=${GIT_REF##*/}

# Get application and environment from workflow inputs (required)
APPLICATION="${{ github.event.inputs.application }}"
ENVIRONMENT="${{ github.event.inputs.environment }}"

# Construct GitHub Environment name: transfers-development, lsrp-production, etc.
GITHUB_ENVIRONMENT="${APPLICATION,,}-${ENVIRONMENT,,}"

# Construct image name: extapp-transfers, extapp-lsrp, etc.
IMAGE_NAME="extapp-${APPLICATION,,}"

CHECKED_OUT_SHA="$(git log -1 '--format=format:%H')"

echo "application=${APPLICATION}" >> $GITHUB_OUTPUT
echo "environment=${GITHUB_ENVIRONMENT}" >> $GITHUB_OUTPUT
echo "environment-lower=${ENVIRONMENT,,}" >> $GITHUB_OUTPUT
echo "branch=$GIT_BRANCH" >> $GITHUB_OUTPUT
echo "checked-out-sha=${CHECKED_OUT_SHA}" >> $GITHUB_OUTPUT
echo "image-name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
Expand Down
17 changes: 2 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# Set the major version of dotnet
ARG DOTNET_VERSION=10.0
# Application to build (Transfers, Lsrp, etc.) - determines which configuration folder to use
ARG APPLICATION=Transfers

# Stage 1 - Build the app using the dotnet SDK
FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_VERSION}-azurelinux3.0 AS build
ARG APPLICATION
WORKDIR /build

# Copy the solution file and source code
Expand All @@ -19,21 +16,11 @@ RUN --mount=type=secret,id=github_token \
dotnet build GovUK.Dfe.FlexForms.Web.sln --no-restore -c Release && \
dotnet publish GovUK.Dfe.FlexForms.Web.sln --no-build -o /app

# Copy application-specific configuration to the published output
# The configurations folder is already inside the Web project and gets published
# But we ensure only the specific application's config is in the final image
RUN mkdir -p /app/configurations/${APPLICATION} && \
cp -f ./src/GovUK.Dfe.FlexForms.Web/configurations/${APPLICATION}/appsettings*.json /app/configurations/${APPLICATION}/

# Stage 2 - Build a runtime environment
FROM mcr.microsoft.com/dotnet/aspnet:${DOTNET_VERSION}-azurelinux3.0 AS final
ARG APPLICATION
WORKDIR /app
LABEL org.opencontainers.image.source="https://github.com/DFE-Digital/external-applications-web"
LABEL org.opencontainers.image.description="External Applications - App"

# Set the application name environment variable for runtime configuration loading
ENV APPLICATION_NAME=${APPLICATION}
LABEL org.opencontainers.image.source="https://github.com/DFE-Digital/flexforms-web"
LABEL org.opencontainers.image.description="Flexforms - Web"

COPY --from=build /app /app
COPY ./script/web-docker-entrypoint.sh /app/docker-entrypoint.sh
Expand Down
Loading