mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
script update for auto version discovery, dockerfile fix for CI
This commit is contained in:
parent
486122f3d8
commit
ce433f0c51
6 changed files with 32 additions and 11 deletions
2
.github/workflows/docker-image.yml
vendored
2
.github/workflows/docker-image.yml
vendored
|
@ -3,7 +3,7 @@ name: Docker Image CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*.*.*"
|
- "*"
|
||||||
jobs:
|
jobs:
|
||||||
build_and_push:
|
build_and_push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
|
@ -6,7 +6,7 @@ name: Go
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*.*.*"
|
- "*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -1,17 +1,24 @@
|
||||||
|
FROM golang:1.22.1 as builder
|
||||||
|
|
||||||
|
COPY go.mod /app/go.mod
|
||||||
|
COPY src/ /app/src
|
||||||
|
COPY Makefile /app
|
||||||
|
WORKDIR /app
|
||||||
|
RUN make get
|
||||||
|
RUN make build
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
|
|
||||||
LABEL maintainer="yusing@6uo.me"
|
LABEL maintainer="yusing@6uo.me"
|
||||||
|
|
||||||
RUN apk add --no-cache tzdata
|
RUN apk add --no-cache tzdata
|
||||||
RUN mkdir /app
|
COPY --from=builder /app/bin/go-proxy /app/
|
||||||
COPY bin/go-proxy /app/
|
|
||||||
COPY templates/ /app/templates
|
COPY templates/ /app/templates
|
||||||
COPY schema/ /app/schema
|
COPY schema/ /app/schema
|
||||||
|
|
||||||
RUN chmod +x /app/go-proxy
|
RUN chmod +x /app/go-proxy
|
||||||
ENV DOCKER_HOST unix:///var/run/docker.sock
|
ENV DOCKER_HOST unix:///var/run/docker.sock
|
||||||
ENV GOPROXY_DEBUG 0
|
ENV GOPROXY_DEBUG 0
|
||||||
ENV GOPROXY_REDIRECT_HTTP 1
|
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
|
@ -6,9 +6,22 @@
|
||||||
|
|
||||||
2. Run setup script
|
2. Run setup script
|
||||||
|
|
||||||
|
To specitfy a version _(optional)_
|
||||||
|
|
||||||
|
```shell
|
||||||
|
export VERSION=latest # will be resolved into real version number
|
||||||
|
export VERSION=<version>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you don't need web config editor
|
||||||
|
|
||||||
|
```shell
|
||||||
|
export SETUP_CODEMIRROR=0
|
||||||
|
```
|
||||||
|
|
||||||
|
Setup:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export VERSION=latest
|
|
||||||
export SETUP_CODEMIRROR=1 # set to 0 if you don't need web config editor
|
|
||||||
wget -qO- https://6uo.me/go-proxy-setup-binary | sudo bash
|
wget -qO- https://6uo.me/go-proxy-setup-binary | sudo bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ BIN_URL="${REPO_URL}/releases/download/${VERSION}/go-proxy"
|
||||||
SRC_URL="${REPO_URL}/archive/refs/tags/${VERSION}.tar.gz"
|
SRC_URL="${REPO_URL}/archive/refs/tags/${VERSION}.tar.gz"
|
||||||
APP_ROOT="/opt/go-proxy/${VERSION}"
|
APP_ROOT="/opt/go-proxy/${VERSION}"
|
||||||
|
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" || "$VERSION" = "latest" ]; then
|
||||||
echo "You must specify a version"
|
VERSION_URL="${REPO_URL}/raw/main/version.txt"
|
||||||
exit 1
|
VERSION=$(wget -qO- "$VERSION_URL")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$APP_ROOT" ]; then
|
if [ -d "$APP_ROOT" ]; then
|
||||||
|
@ -66,7 +66,7 @@ setup() {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# SETUP_CODEMIRROR = 1
|
# SETUP_CODEMIRROR = 1
|
||||||
if [ "$SETUP_CODEMIRROR" = "1" ]; then
|
if [ "$SETUP_CODEMIRROR" != "0" ]; then
|
||||||
make setup-codemirror || echo "make setup-codemirror failed, ignored"
|
make setup-codemirror || echo "make setup-codemirror failed, ignored"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
1
version.txt
Normal file
1
version.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
0.4.4
|
Loading…
Add table
Reference in a new issue