diff --git a/.dockerignore b/.dockerignore index bd2d9b2e6..c00461839 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,7 +8,6 @@ CONTRIBUTING* # Node JS **/node_modules **/dist -.env* .storybook # Docker configs diff --git a/azure-pipeline.yaml b/azure-pipeline.yaml index bd0cda21c..7160ef8c3 100644 --- a/azure-pipeline.yaml +++ b/azure-pipeline.yaml @@ -28,29 +28,31 @@ stages: inputs: targetType: 'inline' script: 'mv $(envStage.secureFilePath) .env' - - - task: Docker@0 + - task: DockerCompose@0 inputs: containerregistrytype: 'Azure Container Registry' azureSubscription: 'S2s-Service' azureContainerRegistry: '{"loginServer":"s2sstage.azurecr.io", "id" : "/subscriptions/734fc759-c3a2-4e22-a478-301dc5b10496/resourceGroups/Space2Study/providers/Microsoft.ContainerRegistry/registries/S2sStage"}' - action: 'Build an image' - dockerFile: '**/docker/Dockerfile.stage' - buildArguments: | - 'NGINX_VERSION=1.19.6' - 'NODE_VERSION=18.14.2' - 'ALPINE_VERSION=3.14' - 'PROXY_API_URL=$(PROXY_API_URL)' - 'password=$(password)' - imageName: 'front-stage:$(Build.BuildId)' + dockerComposeFile: '**/compose.yml' + dockerComposeFileArgs: | + PROXY_API_URL=$(PROXY_API_URL) + password=$(password) + projectName: 'front-stage' + action: 'Build services' + additionalImageTags: '$(Build.BuildId)' - - task: Docker@0 + - task: DockerCompose@0 inputs: containerregistrytype: 'Azure Container Registry' azureSubscription: 'S2s-Service' azureContainerRegistry: '{"loginServer":"s2sstage.azurecr.io", "id" : "/subscriptions/734fc759-c3a2-4e22-a478-301dc5b10496/resourceGroups/Space2Study/providers/Microsoft.ContainerRegistry/registries/S2sStage"}' - action: 'Push an image' - imageName: 'front-stage:$(Build.BuildId)' + dockerComposeFile: '**/compose.yml' + dockerComposeFileArgs: | + PROXY_API_URL=$(PROXY_API_URL) + password=$(password) + projectName: 'front-stage' + action: 'Push services' + additionalImageTags: '$(Build.BuildId)' - stage: Deploy displayName: Deploy image to app service @@ -66,6 +68,6 @@ stages: appType: 'webAppContainer' WebAppName: 's2s-front-stage' DockerNamespace: 's2sstage.azurecr.io' - DockerRepository: 'front-stage' + DockerRepository: 'frontstage_nginx' DockerImageTag: '$(Build.BuildId)' \ No newline at end of file diff --git a/docker/Dockerfile.stage b/docker/Dockerfile.stage index 9e8189712..9b9c28a11 100644 --- a/docker/Dockerfile.stage +++ b/docker/Dockerfile.stage @@ -31,8 +31,8 @@ WORKDIR /usr/src/app RUN apk add --no-cache git # Install Node.js dependencies -RUN --mount=type=bind,source=../package.json,target=package.json,ro \ - --mount=type=bind,source=../package-lock.json,target=package-lock.json,rw \ +RUN --mount=type=bind,source=./package.json,target=package.json,ro \ + --mount=type=bind,source=./package-lock.json,target=package-lock.json,rw \ --mount=type=cache,target=/root/.npm \ npm install --legacy-peer-deps @@ -44,7 +44,7 @@ FROM deps AS build WORKDIR /usr/src/app # Copy the application code -COPY .. . +COPY . . # Build the app RUN npm run build @@ -76,9 +76,9 @@ RUN apk update && apk add --no-cache \ && touch /run/openrc/softlevel # Copy files to the image -COPY ../docker/files/default.conf.template /etc/nginx/templates/default.conf.template -COPY ../docker/files/sshd_config /etc/ssh/ -COPY ../docker/files/ssh_setup.sh /tmp/ +COPY ./docker/files/default.conf.template /etc/nginx/templates/default.conf.template +COPY ./docker/files/sshd_config /etc/ssh/ +COPY ./docker/files/ssh_setup.sh /tmp/ COPY --from=final /usr/src /usr/share/nginx/html # Set the root password