···11+ARG TAG=dev
22+13# Stage 1: Build the Go binary using Just
22-FROM golang:1.20 AS builder
44+FROM golang:1.23.2 AS builder
3546# Install Just in the builder stage
55-RUN apt-get update && apt-get install -y curl && \
66- curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /usr/local/bin/just
77+RUN apt-get update && apt-get install -y curl
88+RUN curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to /app
99+1010+ENV PATH="/app:${PATH}"
711812# Set the working directory in the container
913WORKDIR /app
···1923COPY . .
20242125# Build the Go binary using Just
2222-RUN just build
2626+RUN /app/just build notella ${TAG}
23272428# Stage 2: Create a lightweight image with just the binary
2529FROM alpine:latest
···2832WORKDIR /app
29333034# Copy the binary from the builder stage
3131-COPY --from=builder /app/myapp .
3535+COPY --from=builder /app/notella .
32363337# Expose a port (optional)
3438EXPOSE 8080
35393640# Command to run the binary
3737-CMD ["./myapp"]
4141+CMD ["./notella"]
+10-10
Justfile
···66 go fmt
77 go run server/*.go
8899-build:
99+build output="bin/server" tag="{{current_version}}":
1010 just genprisma
1111 go mod tidy
1212- go build -v -ldflags="-X main.Version={{current_version}}" -o bin/server server/*.go
1212+ go build -v -ldflags="-X main.Version={{tag}}" -o {{output}} server/*.go
13131414docker:
1515- docker build -t notella:{{current_version}} .
1616- docker tag notella:{{current_version}} notella:latest
1717- docker tag notella:{{current_version}} harbor.k8s.inpt.fr/net7/notella:{{current_version}}
1818- docker tag notella:{{current_version}} harbor.k8s.inpt.fr/net7/notella:latest
1919- docker push notella:{{current_version}}
2020- docker push notella:latest
2121- docker push harbor.k8s.inpt.fr/net7/notella:{{current_version}}
2222- docker push harbor.k8s.inpt.fr/net7/notella:latest
1515+ docker build -t uwun/notella:{{current_version}} . --build-arg TAG={{current_version}}
1616+ docker tag uwun/notella:{{current_version}} uwun/notella:latest
1717+ docker tag uwun/notella:{{current_version}} harbor.k8s.inpt.fr/net7/churros/notella:{{current_version}}
1818+ docker tag uwun/notella:{{current_version}} harbor.k8s.inpt.fr/net7/churros/notella:latest
1919+ docker push uwun/notella:{{current_version}}
2020+ docker push uwun/notella:latest
2121+ docker push harbor.k8s.inpt.fr/net7/churros/notella:{{current_version}}
2222+ docker push harbor.k8s.inpt.fr/net7/churros/notella:latest
232324242525install: