This commit is contained in:
parent
073bf775db
commit
76a3047f7f
31
.github/workflows/release.yml
vendored
Normal file
31
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ "main" ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: https://github.com/actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."git.schreifuchs.ch"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
|
|
||||||
|
- name: login
|
||||||
|
run: docker login -u schreifuchs -p ${{ secrets.REGISTRY_TOKEN }} git.schreifuchs.ch
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: https://github.com/docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
push: true
|
||||||
|
tags: "git.schreifuchs.ch/aspergerli/Webchance:latest"
|
30
Dockerfile
Normal file
30
Dockerfile
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
# Use an official Go runtime as a parent image
|
||||||
|
FROM golang:1.22.7-alpine as builder
|
||||||
|
|
||||||
|
# Set the working directory inside the container
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy the Go application code into the container
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Build the Go app, outputting an executable named "app"
|
||||||
|
RUN go build -o app .
|
||||||
|
|
||||||
|
# Use a minimal base image to run the app, keeping the image small
|
||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
# Set the working directory inside the container
|
||||||
|
WORKDIR /root/
|
||||||
|
|
||||||
|
# Copy the binary from the builder image
|
||||||
|
COPY --from=builder /app/app .
|
||||||
|
|
||||||
|
# Copy any necessary static files (if any are in your static folder)
|
||||||
|
COPY --from=builder /app/static ./static
|
||||||
|
|
||||||
|
# Expose the port the app runs on
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Run the app when the container starts
|
||||||
|
CMD ["./app"]
|
Loading…
Reference in New Issue
Block a user