Skip to content

Commit 8a541ed

Browse files
d-linkoDavid LinkoBrianSipos
authored
updating dockerfile to use common base image (#243)
* updating dockerfile to use common base image * Update for sonar security concern * added integration test to github ci * fixed error in yaml * docker-compose to docker compose * updating working directory * added missing checkout step * added latest version of anms-core service * added amp-manager * moved integration test image creatione * added volume creation * using light profile to deploy anms for test * corrected the networks * removed wait * setting compose CMD for volume create * added back wait to anms compose up * added timeout --------- Co-authored-by: David Linko <david.linko@jhuapl.edu> Co-authored-by: Brian Sipos <brian.sipos@jhuapl.edu>
1 parent 9aecd44 commit 8a541ed

File tree

4 files changed

+52
-88
lines changed

4 files changed

+52
-88
lines changed

.github/workflows/anms-core.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,34 @@ jobs:
3030
run: |
3131
FAIL_SRC=0
3232
flake8 src || FAIL_SRC=$?
33+
anms-core_integration-test:
34+
runs-on: ubuntu-24.04
35+
env:
36+
ANMS_COMPOSE_OPTS: -f docker-compose.yml --profile light
37+
TEST_COMPOSE_OPTS: -f anms-core/integration_test/docker-compose.yml
38+
HOST_SOCKDIR: sockdir
39+
CTR_SOCKDIR: /var/tmp/nm
40+
DOCKER_CMD: docker
41+
steps:
42+
- name: Checkout repository
43+
uses: actions/checkout@v4
44+
with:
45+
submodules: recursive
46+
- name: Build ANMS
47+
run: docker compose ${ANMS_COMPOSE_OPTS} build
48+
- name: Build TEST
49+
run: docker compose ${TEST_COMPOSE_OPTS} build
50+
- name: Build Volume
51+
run: |
52+
./create_volume.sh ./puppet/modules/apl_test/files/anms/tls
53+
sudo mkdir /run/anms
54+
- name: run
55+
run: |
56+
docker compose ${ANMS_COMPOSE_OPTS} up -d --force-recreate --wait --wait-timeout 600
57+
docker compose ${TEST_COMPOSE_OPTS} run test-fixture
58+
- name: after_script
59+
run: |
60+
if [ "${CI_JOB_STATUS}" = 'failed' ]; then
61+
docker logs anms-core
62+
fi
63+

anms-core/integration_test/Dockerfile

Lines changed: 0 additions & 43 deletions
This file was deleted.

anms-core/integration_test/docker-compose.yml

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -21,56 +21,22 @@
2121
##
2222

2323
# Combine containers for anms-core and its test fixture
24-
version: '3.9'
24+
name: anms-integration-test
2525

2626
networks:
27-
default:
28-
name: ${DOCKER_CTR_PREFIX}anms
29-
driver_opts:
30-
com.docker.network.bridge.name: br-${DOCKER_CTR_PREFIX}anms
31-
com.docker.network.driver.mtu: 65535
27+
anms:
28+
external: true
29+
3230

3331
services:
3432
# External dependencies first
35-
postgres:
36-
hostname: postgres
37-
image: ${DOCKER_IMAGE_PREFIX}amp-sql:${DOCKER_IMAGE_TAG}
38-
environment:
39-
POSTGRES_USER: ${DB_USER}
40-
POSTGRES_PASSWORD: ${DB_PASSWORD}
41-
POSTGRES_DB: ${DB_NAME}
42-
mqtt-broker:
43-
hostname: mqtt-broker
44-
image: ${DOCKER_IMAGE_PREFIX}mqtt-broker:${DOCKER_IMAGE_TAG}
45-
transcoder:
46-
hostname: transcoder
47-
image: ${DOCKER_IMAGE_PREFIX}transcoder:${DOCKER_IMAGE_TAG}
48-
depends_on:
49-
mqtt-broker:
50-
condition: service_healthy
51-
52-
# anms-core built from *this* working copy (not prebuilt image)
53-
anms-core:
54-
hostname: anms-core
55-
build:
56-
context: ..
57-
volumes:
58-
- /var/run/docker.sock:/var/run/docker.sock
59-
depends_on:
60-
postgres:
61-
condition: service_healthy
62-
mqtt-broker:
63-
condition: service_healthy
64-
environment:
65-
DB_HOST: postgres
66-
DB_USER: ${DB_USER}
67-
DB_PASSWORD: ${DB_PASSWORD}
68-
DB_NAME: ${DB_NAME}
69-
7033
test-fixture:
7134
hostname: test-fixture
7235
build:
73-
context: .
74-
depends_on:
75-
anms-core:
76-
condition: service_healthy
36+
context: ../..
37+
dockerfile: anms.Containerfile
38+
target: anms-core-integration
39+
networks:
40+
- anms
41+
depends_on: {}
42+

anms.Containerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,16 @@ EXPOSE 5555/tcp
260260
HEALTHCHECK --start-period=10s --interval=60s --timeout=10s --retries=20 \
261261
CMD ["curl", "-sq", "-o/dev/null", "http://localhost:5555/hello"]
262262

263+
# for anms-core integration test
264+
FROM yarn-base AS anms-core-integration
265+
266+
# Install node+yarn from upstream
267+
RUN npm install --ignore-scripts -g newman
268+
269+
COPY anms-core/integration_test /root/
270+
WORKDIR /root
271+
CMD ["./run_test.sh"]
272+
263273

264274
# Build on more permissive CentOS image
265275
# Run on RHEL UBI image

0 commit comments

Comments
 (0)