Skip to content

Commit 84cf809

Browse files
committed
Saving docker build
1 parent aa8936a commit 84cf809

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
UBUNTU_TAG=focal-20230801
2+
APSIM_VERSION=7317
3+
GITHUB_CONTAINER_REPO=ghcr.io/jbris/apsimx-docker:${APSIM_VERSION}

Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
ARG UBUNTU_TAG
2+
3+
FROM ubuntu:${UBUNTU_TAG}
4+
5+
ENV DEBIAN_FRONTEND=noninteractive
6+
7+
ARG APSIM_VERSION
8+
9+
RUN apt-get update \
10+
&& apt-get install -y --no-install-recommends libsqlite3-dev tzdata curl ca-certificates build-essential
11+
12+
RUN ln -fs /usr/share/zoneinfo/Pacific/Auckland /etc/localtime && dpkg-reconfigure -f noninteractive tzdata
13+
14+
RUN curl -o /tmp/packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
15+
16+
RUN curl -o /tmp/ApsimSetup.deb https://builds.apsim.info/api/nextgen/download/$APSIM_VERSION/Linux
17+
18+
RUN apt-get update \
19+
&& apt -y install /tmp/packages-microsoft-prod.deb \
20+
&& apt-get update \
21+
&& apt-get install -y --no-install-recommends dotnet-runtime-6.0
22+
23+
RUN apt-get update \
24+
&& apt -y install --no-install-recommends /tmp/ApsimSetup.deb \
25+
&& chmod +x /usr/local/bin/*
26+
27+
RUN rm -rf /tmp/ApsimSetup.deb /tmp/packages-microsoft-prod.deb \
28+
&& apt-get clean \
29+
&& rm -rf /var/lib/apt/lists/* \
30+
&& rm -rf /tmp/downloaded_packages \
31+
&& apt-get -y autoremove --purge

docker-compose.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "3.9"
2+
3+
services:
4+
5+
apsimx:
6+
image: ubuntu:${UBUNTU_TAG}
7+
build:
8+
args:
9+
UBUNTU_TAG: $UBUNTU_TAG
10+
APSIM_VERSION: $APSIM_VERSION

new_release.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
. .env
4+
5+
docker compose pull
6+
docker compose build
7+
8+
echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
9+
10+
DOCKER_IMAGE_HASH=$(docker images --format "{{.ID}} {{.CreatedAt}}" | sort -rk 2 | awk 'NR==1{print $1}')
11+
docker tag "$DOCKER_IMAGE_HASH" "$GITHUB_CONTAINER_REPO"
12+
docker push "$GITHUB_CONTAINER_REPO"

0 commit comments

Comments
 (0)