Skip to content

Commit

Permalink
update docker / makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
neolynx committed Mar 6, 2024
1 parent e564b7c commit 50eaf6c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
17 changes: 11 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ COVERAGE_DIR?=$(shell mktemp -d)

all: modules test bench check system-test

# Self-documenting Makefile
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## Print this help
@grep -E '^[a-zA-Z][a-zA-Z0-9_-]*:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

prepare:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin v1.51.2

Expand Down Expand Up @@ -78,19 +83,19 @@ release: goxc
mkdir -p build/
mv xc-out/$(VERSION)/aptly_$(VERSION)_* build/

man:
man: ## Create man pages
make -C man

version:
version: ## Print aptly version
@echo $(VERSION)

docker-build:
docker-build-system-tests: ## Build system-test docker image
docker build -f system/Dockerfile . -t aptly-system-test

docker-system-tests:
docker-system-tests: ## Run system tests in docker container
docker run -t --rm -v ${PWD}:/app aptly-system-test

golangci-lint:
golangci-lint: ## Run golangci-line in docker container
docker run -t --rm -v ~/.cache/golangci-lint/v1.56.2:/root/.cache -v ${PWD}:/app -w /app golangci/golangci-lint:v1.56.2 golangci-lint run

.PHONY: man modules version release goxc docker-build docker-system-tests
.PHONY: help man modules version release goxc docker-build docker-system-tests
5 changes: 4 additions & 1 deletion system/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ RUN apt-get update -y && apt-get install -y --no-install-recommends curl gnupg &

RUN echo deb http://deb.debian.org/debian bookworm-backports main > /etc/apt/sources.list.d/backports.list
RUN apt-get update && \
apt-get install -y --no-install-recommends apg bzip2 xz-utils ca-certificates golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports make git python3 && \
apt-get install -y --no-install-recommends apg bzip2 xz-utils ca-certificates golang/bookworm-backports golang-go/bookworm-backports golang-doc/bookworm-backports golang-src/bookworm-backports make git python3 python3-venv && \
apt-get clean && rm -rf /var/lib/apt/lists/*

RUN useradd -m --shell /bin/sh --home-dir /var/lib/aptly aptly

RUN mkdir app
WORKDIR /app

RUN su - aptly -c "git clone https://github.com/aptly-dev/aptly-fixture-db.git"
RUN su - aptly -c "git clone https://github.com/aptly-dev/aptly-fixture-pool.git"

CMD /app/system/run-system-tests
5 changes: 4 additions & 1 deletion system/run-system-tests
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ chown -R `stat -c %u /app` /var/lib/aptly
mkdir -p /home/runner
chown -R `stat -c %u /app` /home/runner

exec su - aptly -c "cd /app; go mod tidy; HOME=/home/runner make system-test"
su - aptly -c "cd /app; python3 -m venv system/env"
su - aptly -c "cd /app; go mod tidy; HOME=/home/runner make system-test"

rm -rf system/env

0 comments on commit 50eaf6c

Please sign in to comment.