Skip to content

Commit

Permalink
Change Docker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrii Bohatyrov committed Mar 26, 2024
1 parent 2f3534e commit aa182e1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ CONTRIBUTING*
# Node JS
**/node_modules
**/dist
.env*
.storybook

# Docker configs
Expand Down
32 changes: 17 additions & 15 deletions azure-pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -66,6 +68,6 @@ stages:
appType: 'webAppContainer'
WebAppName: 's2s-front-stage'
DockerNamespace: 's2sstage.azurecr.io'
DockerRepository: 'front-stage'
DockerRepository: 'frontstage_nginx'
DockerImageTag: '$(Build.BuildId)'

12 changes: 6 additions & 6 deletions docker/Dockerfile.stage
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit aa182e1

Please sign in to comment.