feat: Add new docker image
This commit is contained in:
parent
547d60fef9
commit
bb8687df09
@ -4,7 +4,7 @@ on:
|
|||||||
push:
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build Image:
|
Build Main Image:
|
||||||
runs-on: [ubuntu-latest, amd]
|
runs-on: [ubuntu-latest, amd]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -39,3 +39,38 @@ jobs:
|
|||||||
docker push git.woodburn.au/nathanwoodburn/shakecities:$tag_num
|
docker push git.woodburn.au/nathanwoodburn/shakecities:$tag_num
|
||||||
docker tag shakecities:$tag_num git.woodburn.au/nathanwoodburn/shakecities:$tag
|
docker tag shakecities:$tag_num git.woodburn.au/nathanwoodburn/shakecities:$tag
|
||||||
docker push git.woodburn.au/nathanwoodburn/shakecities:$tag
|
docker push git.woodburn.au/nathanwoodburn/shakecities:$tag
|
||||||
|
Build SLDs Image:
|
||||||
|
runs-on: [ubuntu-latest, amd]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install Docker
|
||||||
|
run : |
|
||||||
|
apt-get install ca-certificates curl gnupg
|
||||||
|
install -m 0755 -d /etc/apt/keyrings
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||||
|
chmod a+r /etc/apt/keyrings/docker.gpg
|
||||||
|
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
apt-get update
|
||||||
|
apt-get install docker-ce-cli -y
|
||||||
|
- name: Build Docker image
|
||||||
|
run : |
|
||||||
|
cd sites
|
||||||
|
echo "${{ secrets.DOCKERGIT_TOKEN }}" | docker login git.woodburn.au -u nathanwoodburn --password-stdin
|
||||||
|
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
|
||||||
|
tag=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
|
||||||
|
tag=${tag//\//-}
|
||||||
|
tag_num=${GITHUB_RUN_NUMBER}
|
||||||
|
echo "tag_num=$tag_num"
|
||||||
|
|
||||||
|
if [[ "$tag" == "main" ]]; then
|
||||||
|
tag="latest"
|
||||||
|
else
|
||||||
|
tag_num="${tag}-${tag_num}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build -t shakecities-sites:$tag_num .
|
||||||
|
docker tag shakecities-sites:$tag_num git.woodburn.au/nathanwoodburn/shakecities-sites:$tag_num
|
||||||
|
docker push git.woodburn.au/nathanwoodburn/shakecities-sites:$tag_num
|
||||||
|
docker tag shakecities-sites:$tag_num git.woodburn.au/nathanwoodburn/shakecities-sites:$tag
|
||||||
|
docker push git.woodburn.au/nathanwoodburn/shakecities-sites:$tag
|
@ -11,6 +11,7 @@ COPY . /app
|
|||||||
# Add mount point for data volume
|
# Add mount point for data volume
|
||||||
VOLUME /data
|
VOLUME /data
|
||||||
|
|
||||||
CMD [ "python3", "server.py" ] & [ "python3", "sldserver.py" ]
|
ENTRYPOINT ["python3"]
|
||||||
|
CMD ["server.py"]
|
||||||
|
|
||||||
FROM builder as dev-envs
|
FROM builder as dev-envs
|
20
sites/Dockerfile
Normal file
20
sites/Dockerfile
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
FROM --platform=$BUILDPLATFORM python:3.10-alpine AS builder
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY requirements.txt /app
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
||||||
|
pip3 install -r requirements.txt
|
||||||
|
|
||||||
|
COPY . /app
|
||||||
|
COPY ../templates /app/templates
|
||||||
|
COPY ../.env /app/.env
|
||||||
|
COPY ../requirements.txt /app/requirements.txt
|
||||||
|
|
||||||
|
# Add mount point for data volume
|
||||||
|
VOLUME /data
|
||||||
|
|
||||||
|
ENTRYPOINT ["python3"]
|
||||||
|
CMD ["sldserver.py"]
|
||||||
|
|
||||||
|
FROM builder as dev-envs
|
Loading…
Reference in New Issue
Block a user