mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-16 20:20:58 +01:00
+
This commit is contained in:
41
docker/Dockerfile
Normal file
41
docker/Dockerfile
Normal file
@@ -0,0 +1,41 @@
|
||||
# syntax=docker/dockerfile:1 -*-python-*-
|
||||
FROM golang:1.18-alpine
|
||||
ARG VERSION
|
||||
LABEL upd_version=0.1
|
||||
|
||||
ENV HOME="/" \
|
||||
OS_ARCH="amd64" \
|
||||
OS_FLAVOUR="alpine" \
|
||||
OS_NAME="linux"
|
||||
|
||||
RUN echo $VERSION
|
||||
RUN install -o 1001 -g 1001 -d /data
|
||||
|
||||
WORKDIR /build
|
||||
RUN mkdir -p api cfg cmd
|
||||
COPY upd/api/* ./api/
|
||||
COPY upd/cfg/* ./cfg/
|
||||
COPY upd/cmd/* ./cmd/
|
||||
COPY upd/*.* ./
|
||||
RUN go mod tidy
|
||||
#RUN echo $VERSION
|
||||
# doesn't work, see
|
||||
# https://blog.alexellis.io/inject-build-time-vars-golang/
|
||||
RUN go build -ldflags "-X upd/cfg.VERSION=$VERSION"
|
||||
RUN echo $VERSION > version
|
||||
RUN ls -l
|
||||
|
||||
|
||||
WORKDIR /app
|
||||
RUN cp /build/upd /app/upd
|
||||
#RUN rm -rf /build
|
||||
|
||||
ENV UPD_LISTEN=:8080
|
||||
ENV UPD_STORAGEDIR=/data
|
||||
ENV UPD_DBFILE=/data/bbolt.db
|
||||
ENV UPD_DEBUG=1
|
||||
|
||||
USER 1001:1001
|
||||
EXPOSE 8080
|
||||
VOLUME /data
|
||||
CMD ["/app/upd"]
|
||||
14
docker/Makefile
Normal file
14
docker/Makefile
Normal file
@@ -0,0 +1,14 @@
|
||||
upd = ../upd/upd
|
||||
version = $(shell egrep "= .v" ../upd/cfg/config.go | cut -d'=' -f2 | cut -d'"' -f 2)
|
||||
BRANCH = $(shell git branch --show-current)
|
||||
COMMIT = $(shell git rev-parse --short=8 HEAD)
|
||||
BUILD = $(shell date +%Y.%m.%d.%H%M%S)
|
||||
VERSION := $(if $(filter $(BRANCH), development),$(version)-$(BRANCH)-$(COMMIT)-$(BUILD),$(version))
|
||||
|
||||
v:
|
||||
@echo $(VERSION)
|
||||
|
||||
build:
|
||||
cp -a ../updlocal upd
|
||||
make -C upd clean
|
||||
docker-compose build --build-arg VERSION=$(VERSION)
|
||||
6
docker/docker-compose.yml
Normal file
6
docker/docker-compose.yml
Normal file
@@ -0,0 +1,6 @@
|
||||
version: "3.9"
|
||||
services:
|
||||
upd:
|
||||
build: .
|
||||
ports:
|
||||
- "8080:8080"
|
||||
Reference in New Issue
Block a user