aboutsummaryrefslogtreecommitdiffstats
path: root/ci/build.yml
blob: 6e71a00820b67afc0ce0b5097b50c1ddf1af3b39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
steps:
  - task: ShellScript@2
    displayName: 'Check If Images Need to Be Built'
    inputs:
      scriptPath: scripts/check_dockerfiles.sh
      disableAutoCwd: true

  # Without a login, the following Docker build steps wouldn't add image tags.
  - task: Docker@1
    displayName: 'Log into Docker Hub'
    inputs:
      command: login
      containerregistrytype: 'Container Registry'
      dockerRegistryEndpoint: 'DockerHub'

  # Building the venv depends on this base image. Build the base if it can't
  # pulled from Docker Hub, which will be the case if the base Dockerfile has
  # has had changes.
  - script: |
      docker build \
        -f docker/base.Dockerfile \
        -t pythondiscord/snekbox-base:latest \
        .
    displayName: 'Build Base Image'
    condition: and(succeeded(), eq(variables.BASE_PULL, 'False'))

  # Build the venv image if it's had changes.
  - script: |
      docker build \
        -f docker/venv.Dockerfile \
        -t pythondiscord/snekbox-venv:latest \
        .
    displayName: 'Build Virtual Environment Image'
    condition: and(succeeded(), eq(variables.VENV_CHANGED, 'True'))