-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (34 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
44 lines (34 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Temp container to build using Go for ARM/ARM64
FROM --platform=$BUILDPLATFORM golang:1.25-rc-bookworm AS builder
# Set environment variables for ARM architecture
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ENV APP_HOME=/usr/app/
WORKDIR $APP_HOME
# Copy application source code
COPY . .
# Ensure the build script is executable
RUN chmod +x build.sh
# Build the application for the target architecture
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH GOARM=${TARGETVARIANT#v} ./build.sh
# Actual runtime container
FROM --platform=$TARGETPLATFORM alpine:3
ENV ARTIFACT_NAME=plugin-master
ENV APP_HOME=/usr/app/
ARG USERNAME=pluginmaster
WORKDIR $APP_HOME
# Copy the built application from the builder container
COPY --from=builder $APP_HOME/$ARTIFACT_NAME .
# Create a user and set permissions
RUN addgroup -S $USERNAME && \
adduser -S $USERNAME -G $USERNAME && \
chown $USERNAME:$USERNAME $ARTIFACT_NAME && \
chmod +x $ARTIFACT_NAME
# Switch to the non-root user
USER $USERNAME
# Expose application ports
EXPOSE 8069
EXPOSE 8080
# Run the application
CMD ["./plugin-master"]