Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
mtlynch committed Feb 3, 2024
1 parent 8efe7a2 commit 0f32ff5
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ jobs:
at: ./
- run:
name: Compile production backend
command: dev-scripts/build-backend
command: PS_VERSION="${CIRCLE_TAG-''}" dev-scripts/build-backend
- run:
name: Compile dev backend
command: dev-scripts/build-backend dev
command: PS_VERSION="${CIRCLE_TAG-''}" dev-scripts/build-backend dev
- persist_to_workspace:
root: ./
paths:
Expand Down Expand Up @@ -129,10 +129,10 @@ jobs:
docker buildx build \
--platform "${BUILD_TARGETS}" \
--target=artifact \
--output "type=local,dest=$(pwd)/build/" \
--output "type=local,dest=$(pwd)/bin/" \
.
- store_artifacts:
path: build
path: bin
- run:
name: Install compress utility for gzip compression
command: |
Expand Down
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.vscode/
data/
bin/
build/
dist/
.coverage*
*.env
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM golang:1.21.1 AS builder

ARG TARGETPLATFORM
ARG PS_VERSION

COPY ./build /app/build
COPY ./cmd /app/cmd
COPY ./dev-scripts /app/dev-scripts
COPY ./garbagecollect /app/garbagecollect
Expand All @@ -14,7 +16,9 @@ COPY ./go.* /app/

WORKDIR /app

RUN TARGETPLATFORM="${TARGETPLATFORM}" ./dev-scripts/build-backend "prod"
RUN TARGETPLATFORM="${TARGETPLATFORM}" \
PS_VERSION="${PS_VERSION}" \
./dev-scripts/build-backend "prod"

FROM scratch as artifact
COPY --from=builder /app/bin/picoshare ./
Expand Down
2 changes: 0 additions & 2 deletions dev-scripts/build-backend
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ readonly BUILD_TAGS_JOINED
# cgo is required for mattn/go-sqlite3.
export CGO_ENABLED=1

PS_VERSION="$(git describe --tags)"

go build \
-tags "${BUILD_TAGS_JOINED}" \
-ldflags "-w -extldflags '-static' -X 'github.com/mtlynch/picoshare/v2/build.Version=${PS_VERSION}' -X 'github.com/mtlynch/picoshare/v2/build.unixTime=$(date +%s)'" \
Expand Down
2 changes: 1 addition & 1 deletion dev-scripts/package-binaries
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
readonly SCRIPT_DIR
cd "${SCRIPT_DIR}/.."

cd build
cd bin

readonly OUTPUT_DIR="${PWD}/../dist"
mkdir -p "${OUTPUT_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion dev-scripts/run-e2e-tests
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ readonly SCRIPT_DIR
cd "${SCRIPT_DIR}/.."

if [[ "${REBUILD}" == "true" ]]; then
./dev-scripts/build-backend dev
PS_VERSION="$(git describe --tags)" ./dev-scripts/build-backend dev
fi

cd e2e
Expand Down
Binary file added docker-build/picoshare
Binary file not shown.
5 changes: 3 additions & 2 deletions handlers/templates/pages/disk-usage.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
{{ end }}

{{ define "content" }}
<h1 class="title">Disk Usage</h1>
<h1 class="title">System Information</h1>

<h2>Disk Usage</h2>
<progress
class="progress is-primary"
max="{{ .TotalBytes }}"
Expand Down Expand Up @@ -57,9 +58,9 @@ <h1 class="title">Disk Usage</h1>
</div>

<h2>Build info</h2>
<p>Version: {{ .Version }}</p>

<p>Build time: {{ .BuildTime }}</p>
<p>Version: {{ .Version }}</p>
{{ end }}

{{ template "base.html" }}
6 changes: 3 additions & 3 deletions handlers/templates/partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" role="menuitem">System</a>
<div class="navbar-dropdown">
<a class="navbar-item" role="menuitem" href="/disk-usage"
>Information</a
>
<a class="navbar-item" role="menuitem" href="/settings"
>Settings</a
>
<a class="navbar-item" role="menuitem" href="/disk-usage"
>Disk Usage</a
>
<a id="navbar-log-out" class="navbar-item" role="menuitem"
>Log Out</a
>
Expand Down
2 changes: 1 addition & 1 deletion modd.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
**/*.go !**/*_test.go **/*.html **/*.js **/*.css {
daemon: dev-scripts/build-backend dev && PS_SHARED_SECRET=somepassword ./bin/picoshare-dev -db data/store.db
daemon: PS_VERSION="$(git describe --tags)" dev-scripts/build-backend dev && PS_SHARED_SECRET=somepassword ./bin/picoshare-dev -db data/store.db
}

0 comments on commit 0f32ff5

Please sign in to comment.