Skip to content

Commit 753b1bc

Browse files
committed
Merge branch 'dev'
2 parents 78126fb + 06b50a4 commit 753b1bc

File tree

12 files changed

+9022
-6753
lines changed

12 files changed

+9022
-6753
lines changed

.github/workflows/build-images.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Docker Image CI
2+
3+
# This workflow builds the necessary Docker images for the sd-graph production system. The images are built on every
4+
# push to master and dev, which are the two branches used for deployment to the prod and staging servers. The images
5+
# are versioned with the branch name, which discards any older builds, but they are not needed at the moment and could
6+
# simply be rebuilt with the commands below.
7+
8+
on:
9+
push:
10+
branches: ['master', 'dev']
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_SOURCE: https://github.com/source-data/sd-graph
15+
IMAGE_REVISION: ${{ github.sha }}
16+
IMAGE_TAG: ${{ github.ref_name }}
17+
18+
jobs:
19+
build-and-push-image:
20+
runs-on: ubuntu-latest
21+
22+
permissions:
23+
contents: read
24+
packages: write
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v3
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Build the Docker images
38+
run: docker-compose -f docker-compose.ci.yml build
39+
40+
- name: Push the Docker images
41+
run: docker-compose -f docker-compose.ci.yml push

compose/local/vuejs/Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ ENV PATH /app/node_modules/.bin:$PATH
1010
# install and cache app dependencies
1111
COPY ./frontend/package.json /app/package.json
1212
COPY ./frontend/package-lock.json /app/package-lock.json
13-
RUN npm install
14-
RUN npm install @vue/cli
13+
RUN npm ci
1514

1615
COPY ./compose/local/vuejs/start /start
1716
RUN sed -i 's/\r$//g' /start

compose/production/vuejs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
FROM node:13.12 as build-stage
44
WORKDIR /app
55
COPY ./frontend/package*.json ./
6-
RUN npm install
6+
RUN npm ci
77
COPY ./frontend .
88
RUN npm run build
99

compose/production/vuejs/start

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

deploy/__db__/remote

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Set of scripts to be exectued on the remote host as part of the
44
# database deployment task
55
#
6+
export IMAGE_TAG="$(git branch --show-current)"
7+
68
echo ' * [remote] stopping docker'
79
docker-compose -f production.yml down
810

deploy/code

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ sub_production(){
2727
cd sd-graph/ && \
2828
git checkout master && \
2929
git pull && \
30+
export IMAGE_TAG="master" && \
3031
docker-compose -f production.yml build && \
3132
docker-compose -f production.yml up -d
3233
EOF
@@ -39,7 +40,8 @@ sub_staging(){
3940
cd sd-graph/ && \
4041
git checkout dev && \
4142
git pull && \
42-
docker-compose -f production.yml build && \
43+
export IMAGE_TAG="dev" && \
44+
docker-compose -f production.yml pull && \
4345
docker-compose -f production.yml up -d
4446
EOF
4547
echo "[deploy:staging] DONE :)"

deploy/db

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mail_developers(){
1212
local body=$2
1313

1414
if [ ! -z $LOG_FILE ]; then
15-
local body="$2\n\n----------\n\nLast 50 lines of the log file @ $LOG_FILE\n\n$(tail -50 $LOG_FILE)"
15+
local body="$2\n\nlog file: $LOG_FILE\n\nImportant messages in the log:\n\n$(grep -i error $LOG_FILE)\n\n----------\n\nLast 50 lines of the log:\n\n$(tail -50 $LOG_FILE)"
1616
fi
1717

1818
echo -e "$body" | mail -s "[sd-graph deploy/db] $subject" $developers_emails

docker-compose.ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This file is used by the CI system (Github Actions) to build three of the five images that comprise the production
2+
# system as defined in production.yml (the other two use plain, pre-built images).
3+
# They are stored in the Github Container Registry under the image tag specified here. See the Github Actions workflow
4+
# definition for information on the environment variables used here.
5+
services:
6+
flask:
7+
image: ghcr.io/source-data/sd-graph_flask:${IMAGE_TAG}
8+
build:
9+
context: .
10+
dockerfile: ./compose/production/flask/Dockerfile
11+
labels:
12+
org.opencontainers.image.source: ${IMAGE_SOURCE}
13+
org.opencontainers.image.revision: ${IMAGE_REVISION}
14+
15+
traefik:
16+
image: ghcr.io/source-data/sd-graph_traefik:${IMAGE_TAG}
17+
build:
18+
context: .
19+
dockerfile: ./compose/production/traefik/Dockerfile
20+
labels:
21+
org.opencontainers.image.source: ${IMAGE_SOURCE}
22+
org.opencontainers.image.revision: ${IMAGE_REVISION}
23+
24+
vuejs:
25+
image: ghcr.io/source-data/sd-graph_vuejs:${IMAGE_TAG}
26+
build:
27+
context: .
28+
dockerfile: ./compose/production/vuejs/Dockerfile
29+
labels:
30+
org.opencontainers.image.source: ${IMAGE_SOURCE}
31+
org.opencontainers.image.revision: ${IMAGE_REVISION}

0 commit comments

Comments
 (0)