Skip to content

Commit

Permalink
TMP: does this fix
Browse files Browse the repository at this point in the history
?
  • Loading branch information
KevinMind committed May 24, 2024
1 parent 800b6d5 commit 3adfc0f
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ workflows:
- devhub
- main
# Uncomment if you want to test the docker build
# - build-image
- build-image
- reviewers-and-zadmin
- es-tests
- localization
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/build-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ runs:
targets: web
push: ${{ inputs.push }}
load: ${{ inputs.push == 'false' }}
files: |
docker-compose.yml
docker-compose.build.yml
${{ steps.meta.outputs.bake-file-annotations }}
${{ steps.meta.outputs.bake-file-labels }}
${{ steps.meta.outputs.bake-file-tags }}
- name: Get image digest
id: digest
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/run-docker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inputs:
compose_file:
description: 'The docker-compose file to use'
required: false
default: 'docker-compose.yml'
default: 'docker-compose.yml:docker-compose.ci.yml'
runs:
using: 'composite'
steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/extract-locales.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
- name: Extract Locales
uses: ./.github/actions/run-docker
with:
compose_file: docker-compose.yml
run: |
make extract_locales
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/verify-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ jobs:
uses: ./.github/actions/run-docker
with:
version: ${{ steps.build.outputs.version }}
compose_file: docker-compose.yml
run: |
make docs
Expand Down Expand Up @@ -112,6 +113,7 @@ jobs:
uses: ./.github/actions/run-docker
with:
version: ${{ steps.build.outputs.version }}
compose_file: docker-compose.yml
run: make extract_locales

- name: Push Locales (dry-run)
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ deps/*
private/

# do not ignore the following files
!docker-compose.build.yml
!docker-compose.ci.yml
!docker-compose.private.yml
!private/README.md
!deps/.keep
Expand Down
14 changes: 12 additions & 2 deletions Makefile-os
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Variables referenced in docker-compose*.yml should be read from .env, exported and saved in .env
####################################################################################################

export DOCKER_PULL ?= missing
DOCKER_BUILDER ?= container
DOCKER_PROGRESS ?= auto
DOCKER_PUSH ?= false
Expand All @@ -17,6 +18,13 @@ override BACKUPS_DIR = $(shell pwd)/backups
override EXPORT_DIR = $(BACKUPS_DIR)/$(shell date +%Y%m%d%H%M%S)
RESTORE_DIR ?= $(BACKUPS_DIR)/$(shell ls -1 backups | sort -r | head -n 1)

DOCKER_COMPOSE_ARGS := -d \
--wait \
--remove-orphans \
--force-recreate \
--quiet-pull \
--build \
--pull=$(DOCKER_PULL) \

.PHONY: help_redirect
help_redirect:
Expand Down Expand Up @@ -77,6 +85,8 @@ create_docker_builder: ## Create a custom builder for buildkit to efficiently bu
BUILDX_BAKE_COMMAND += \
--progress=$(DOCKER_PROGRESS) \
--builder=$(DOCKER_BUILDER) \
--file=docker-compose.yml \
--file=docker-compose.build.yml \

ifeq ($(DOCKER_PUSH), true)
BUILDX_BAKE_COMMAND += --push
Expand Down Expand Up @@ -123,7 +133,7 @@ clean_docker: docker_compose_down docker_mysqld_volume_remove ## Clean up docker

.PHONY: docker_compose_up
docker_compose_up: docker_mysqld_volume_create ## Start the docker containers
docker compose up $(DOCKER_SERVICES) -d --wait --remove-orphans --force-recreate --quiet-pull $(ARGS)
docker compose up $(DOCKER_SERVICES) $(DOCKER_COMPOSE_ARGS) || docker compose logs deps_container

.PHONY: docker_extract_deps
docker_extract_deps: ## Extract dependencies from the docker image to a local volume mount
Expand All @@ -138,7 +148,7 @@ docker_extract_deps: ## Extract dependencies from the docker image to a local vo
touch deps/package-lock.json
# mounting ./deps:/deps effectively removes dependencies from the /deps directory in the container
# running `update_deps` will install the dependencies in the /deps directory before running
docker compose run --rm web make update_deps
docker compose -f docker-compose.yml run --rm web make update_deps

.PHONY: up
up: setup docker_mysqld_volume_create docker_extract_deps docker_compose_up ## Create and start docker compose
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
services:
web:
pull_policy: never
build:
context: .
dockerfile: Dockerfile
cache_from:
- type=gha
cache_to:
- type=gha,mode=max
x-bake:
pull: true
platforms: linux/amd64
9 changes: 9 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
web: &web
environment:
- HOST_UID=9500
volumes:
- /data/olympia

worker:
<<: *web
10 changes: 0 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@ services:
worker: &worker
<<: *env
image: ${DOCKER_TAG:-}
build:
context: .
dockerfile: Dockerfile
cache_from:
- type=gha
cache_to:
- type=gha,mode=max
x-bake:
pull: true
platforms: linux/amd64
# We drop down to a different user through supervisord, but starting as
# root allows us to fix the ownership of files generated at image build
# time through the ./docker/entrypoint.sh script.
Expand Down
3 changes: 3 additions & 0 deletions scripts/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def get_docker_tag():

set_env_file(
{
'COMPOSE_FILE': get_value(
'COMPOSE_FILE', ('docker-compose.yml:docker-compose.build.yml')
),
'DOCKER_TAG': docker_tag,
'HOST_UID': get_value('HOST_UID', os.getuid()),
'SUPERUSER_EMAIL': get_value(
Expand Down
4 changes: 4 additions & 0 deletions tests/make/make.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ const testCases = [
...standardPermutations('HOST_UID', process.getuid().toString()),
...standardPermutations('SUPERUSER_EMAIL', gitConfigUserEmail()),
...standardPermutations('SUPERUSER_USERNAME', gitConfigUserName()),
...standardPermutations(
'COMPOSE_FILE',
'docker-compose.yml:docker-compose.build.yml',
),
];

describe.each(testCases)('.env file', ({ name, file, env, expected }) => {
Expand Down

0 comments on commit 3adfc0f

Please sign in to comment.