mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 13:56:57 +00:00
add files
This commit is contained in:
parent
f407fd3ae4
commit
b160704690
2 changed files with 32 additions and 8 deletions
|
@ -29,9 +29,10 @@ steps:
|
||||||
|
|
||||||
docker-dryrun:
|
docker-dryrun:
|
||||||
depends_on: vendor
|
depends_on: vendor
|
||||||
image: plugins/kaniko:1.8.8
|
image: woodpeckerci/plugin-docker-buildx:3.2.1
|
||||||
settings:
|
settings:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
platforms: linux/amd64,arm64
|
||||||
no_push: true
|
no_push: true
|
||||||
tags: latest
|
tags: latest
|
||||||
when:
|
when:
|
||||||
|
@ -98,10 +99,11 @@ steps:
|
||||||
|
|
||||||
docker-next:
|
docker-next:
|
||||||
depends_on: vendor
|
depends_on: vendor
|
||||||
image: plugins/kaniko:1.8.8
|
image: woodpeckerci/plugin-docker-buildx:3.2.1
|
||||||
settings:
|
settings:
|
||||||
registry: codeberg.org
|
registry: codeberg.org
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
platforms: linux/amd64,arm64
|
||||||
repo: codeberg.org/codeberg/pages-server
|
repo: codeberg.org/codeberg/pages-server
|
||||||
tags: next
|
tags: next
|
||||||
username:
|
username:
|
||||||
|
@ -114,10 +116,11 @@ steps:
|
||||||
|
|
||||||
docker-tag:
|
docker-tag:
|
||||||
depends_on: vendor
|
depends_on: vendor
|
||||||
image: plugins/kaniko:1.8.8
|
image: woodpeckerci/plugin-docker-buildx:3.2.1
|
||||||
settings:
|
settings:
|
||||||
registry: codeberg.org
|
registry: codeberg.org
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
platforms: linux/amd64,arm64
|
||||||
repo: codeberg.org/codeberg/pages-server
|
repo: codeberg.org/codeberg/pages-server
|
||||||
tags: [latest, '${CI_COMMIT_TAG}']
|
tags: [latest, '${CI_COMMIT_TAG}']
|
||||||
username:
|
username:
|
||||||
|
|
31
Dockerfile
31
Dockerfile
|
@ -1,14 +1,35 @@
|
||||||
FROM techknowlogick/xgo as build
|
# Set the default Go version as a build argument
|
||||||
|
ARG XGO="go-1.21.x"
|
||||||
|
|
||||||
WORKDIR /workspace
|
# Use xgo (a Go cross-compiler tool) as build image
|
||||||
|
FROM --platform=$BUILDPLATFORM techknowlogick/xgo:${XGO} as build
|
||||||
|
|
||||||
COPY . .
|
# Set the working directory and copy the source code
|
||||||
RUN CGO_ENABLED=1 go build -tags 'sqlite sqlite_unlock_notify netgo' -ldflags '-s -w -extldflags "-static" -linkmode external' .
|
WORKDIR /go/src/codeberg.org/codeberg/pages
|
||||||
|
COPY . /go/src/codeberg.org/codeberg/pages
|
||||||
|
|
||||||
|
# Set the target architecture (can be set using --build-arg), buildx set it automatically
|
||||||
|
ARG TARGETOS TARGETARCH
|
||||||
|
|
||||||
|
# Build the binary using xgo
|
||||||
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||||
|
--mount=type=cache,target=/go/pkg \
|
||||||
|
GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=1 \
|
||||||
|
xgo -x -v -tags='sqlite sqlite_unlock_notify netgo' -ldflags='-s -w -extldflags "-static" -linkmode external' -out pages .
|
||||||
|
|
||||||
|
# Use a scratch image as the base image for the final container,
|
||||||
|
# which will contain only the built binary and the CA certificates
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=build /workspace/pages /pages
|
|
||||||
|
# Copy the built binary and the CA certificates from the build container to the final container
|
||||||
|
COPY --from=build /src/pages-* /pages
|
||||||
COPY --from=build \
|
COPY --from=build \
|
||||||
/etc/ssl/certs/ca-certificates.crt \
|
/etc/ssl/certs/ca-certificates.crt \
|
||||||
/etc/ssl/certs/ca-certificates.crt
|
/etc/ssl/certs/ca-certificates.crt
|
||||||
|
|
||||||
|
# Expose ports 80 and 443 for the built binary to listen on
|
||||||
|
EXPOSE 80/tcp
|
||||||
|
EXPOSE 443/tcp
|
||||||
|
|
||||||
|
# Set the entrypoint for the container to the built binary
|
||||||
ENTRYPOINT ["/pages"]
|
ENTRYPOINT ["/pages"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue