Skip to content

Commit

Permalink
Merge pull request #89 from isZumpo/devcontainer
Browse files Browse the repository at this point in the history
Add initial devcontainer integration
  • Loading branch information
tphakala authored Mar 30, 2024
2 parents 4e36e8f + 6eade2f commit 2a19c6c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Go Build Environment",
"dockerFile": "../Dockerfile",
"build": {
"context": "..",
"target": "buildenv"
},
"runArgs": ["--device=/dev/snd"],
"containerEnv": {
"ALSA_CARD": "0"
},
"postCreateCommand": "apt-get update && apt-get install -y ca-certificates libasound2 ffmpeg sox && apt-get clean && go install github.com/cosmtrek/air@latest",
"postAttachCommand": "make dev_server"
}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use ARGs to define default build-time variables for TensorFlow version and target platform
ARG TENSORFLOW_VERSION=v2.14.0

FROM golang:1.22.1-bookworm as build
FROM golang:1.22.1-bookworm as buildenv

# Pass in ARGs after FROM to use them in build stage
ARG TENSORFLOW_VERSION
Expand Down Expand Up @@ -33,6 +33,8 @@ WORKDIR /root/src
# Download TensorFlow headers
RUN git clone --branch ${TENSORFLOW_VERSION} --depth 1 https://github.com/tensorflow/tensorflow.git

FROM buildenv as build

# Compile BirdNET-Go
COPY . BirdNET-Go
RUN --mount=type=cache,target=/go/pkg/mod \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ darwin_arm64: TFLITE_LIB_ARCH=tflite_c_$(TFLITE_VERSION)_darwin_arm64.tar.gz
darwin_arm64: $(LABELS_ZIP) check-tools check-tensorflow download-tflite install-tflite build
$(CGO_FLAGS) go build $(LDFLAGS) -o $(BINARY_DIR)/$(BINARY_NAME)

dev_server:
$(CGO_FLAGS) air realtime

clean:
go clean
rm -rf $(BINARY_DIR)/* tflite_c *.tar.gz *.zip

0 comments on commit 2a19c6c

Please sign in to comment.