new: docker image workflow
All checks were successful
Build docker image / build (push) Successful in 52s
All checks were successful
Build docker image / build (push) Successful in 52s
Signed-off-by: ngn <ngn@ngn.tf>
This commit is contained in:
parent
1ee2dee9de
commit
52e1a3ec8a
28
.gitea/workflows/docker.yml
Normal file
28
.gitea/workflows/docker.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: Build docker image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["main"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: git.matterlinux.xyz
|
||||||
|
IMAGE: ${{gitea.repository}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: "https://github.com/actions/checkout@v4"
|
||||||
|
|
||||||
|
- name: Login to container repo
|
||||||
|
uses: "https://github.com/docker/login-action@v1"
|
||||||
|
with:
|
||||||
|
registry: ${{env.REGISTRY}}
|
||||||
|
username: ${{gitea.actor}}
|
||||||
|
password: ${{secrets.PACKAGES_TOKEN}}
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: |
|
||||||
|
docker build --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest .
|
||||||
|
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest
|
17
Dockerfile
17
Dockerfile
@ -2,16 +2,23 @@ FROM golang:1.23.2
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY *.go ./
|
RUN useradd runner -r -u 1001 -d /app
|
||||||
|
RUN chown -R runner:runner /app
|
||||||
|
USER runner
|
||||||
|
|
||||||
COPY *.mod ./
|
COPY *.mod ./
|
||||||
COPY *.sum ./
|
COPY *.sum ./
|
||||||
|
|
||||||
COPY log ./log
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY *.go ./
|
||||||
|
COPY Makefile ./
|
||||||
COPY lib ./lib
|
COPY lib ./lib
|
||||||
COPY routes ./routes
|
COPY log ./log
|
||||||
COPY public ./public
|
COPY public ./public
|
||||||
|
COPY routes ./routes
|
||||||
COPY templates ./templates
|
COPY templates ./templates
|
||||||
|
|
||||||
RUN go build .
|
RUN make
|
||||||
|
|
||||||
ENTRYPOINT ["/app/website"]
|
ENTRYPOINT ["/app/tracker"]
|
||||||
|
17
README.md
17
README.md
@ -1,25 +1,24 @@
|
|||||||
# website | MatterLinux website
|
# website | MatterLinux website
|
||||||
|
|
||||||
|
![](https://git.matterlinux.xyz/matter/website/actions/workflows/docker.yml/badge.svg)
|
||||||
|
|
||||||
Soruce code of Matterlinux's offical website, which is
|
Soruce code of Matterlinux's offical website, which is
|
||||||
located at [matterlinux.xyz](https://matterlinux.xyz)
|
located at [matterlinux.xyz](https://matterlinux.xyz)
|
||||||
|
|
||||||
### Deployment
|
### Deployment
|
||||||
Web server can be built and deployed with docker compose using the following
|
Web server can be deployed with docker compose using the following configuration file:
|
||||||
configuration file:
|
|
||||||
```yaml
|
```yaml
|
||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
website:
|
website:
|
||||||
image: matterwebsite
|
container_name: matterwebsite
|
||||||
restart: unless-stopped
|
image: git.matterlinux.xyz/matter/website
|
||||||
build:
|
|
||||||
context: ./
|
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:9878:9878"
|
- "127.0.0.1:9878:9878"
|
||||||
volumes:
|
volumes:
|
||||||
- "./content:/app/content"
|
- "./content:/app/content"
|
||||||
|
restart: unless-stopped
|
||||||
```
|
```
|
||||||
After saving the configuration file, you can build and run the docker container:
|
After saving the configuration file, you can run the docker container:
|
||||||
```bash
|
```bash
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user