- Updated the announcement detail component to directly use images and videos from the data structure. - Changed the form edit component to accommodate the new media structure, replacing AnnunciWithImages with AnnunciWithMedia. - Modified the announcements list to initialize videos as an empty array. - Enhanced the announcement view to handle external videos and updated the footer to display them correctly. - Introduced a new utility function to generate YouTube embed URLs. - Updated the database schema to replace url_video with external_videos and added a new videos_refs table for video management. - Implemented video processing logic, including downloading, transcoding, and thumbnail generation. - Added migration scripts for the new videos_refs table and updated existing references in the database.
65 lines
1.5 KiB
Docker
65 lines
1.5 KiB
Docker
# Start from the latest golang base image
|
|
FROM golang:1.24-bullseye AS builder
|
|
|
|
# Set the Current Working Directory inside the container
|
|
WORKDIR /app
|
|
|
|
# Copy go mod and sum files
|
|
COPY go.mod go.sum ./
|
|
|
|
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
|
|
RUN go mod download
|
|
|
|
# Copy the source from the current directory to the Working Directory inside the container
|
|
COPY . .
|
|
|
|
# Build the Go app
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
|
|
|
|
# Start a new stage from alpine:latest
|
|
FROM alpine:latest AS runner
|
|
|
|
ARG POSTGRES_USER
|
|
ARG POSTGRES_PASSWORD
|
|
ARG POSTGRES_DB
|
|
ARG PGHOST
|
|
ARG PGPORT
|
|
ARG IMAGEOPTION
|
|
ARG CONCURRENT_IMAGES
|
|
ARG STORAGE_URL
|
|
ARG STORAGE_TOKEN
|
|
|
|
RUN apk add --no-cache ffmpeg ca-certificates libc6-compat
|
|
ENV GOMEMLIMIT=2750MiB
|
|
ENV GOGC=100
|
|
ENV PGHOST=$PGHOST
|
|
ENV POSTGRES_DB=$POSTGRES_DB
|
|
ENV PGPORT=$PGPORT
|
|
ENV POSTGRES_USER=$POSTGRES_USER
|
|
ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD
|
|
ENV IMAGEOPTION=$IMAGEOPTION
|
|
ENV CONCURRENT_IMAGES=$CONCURRENT_IMAGES
|
|
ENV STORAGE_URL=$STORAGE_URL
|
|
ENV STORAGE_TOKEN=$STORAGE_TOKEN
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy the Pre-built binary file from the previous stage
|
|
COPY --from=builder /app/main /app/.
|
|
COPY --from=builder /app/public /app/public
|
|
COPY --from=builder /app/test.jpg /app/test.jpg
|
|
COPY --from=builder /app/scripts /app/scripts
|
|
RUN chmod +x /app/scripts/*.sh
|
|
|
|
#COPY --from=builder /app/.env /app/.env
|
|
# create folders
|
|
RUN mkdir images
|
|
RUN mkdir videos
|
|
|
|
RUN apk add curl
|
|
|
|
# Expose port 1323 to the outside world
|
|
EXPOSE 1323
|
|
|
|
# Command to run the executable
|
|
CMD ["./main"]
|